0

The question I'm working on:

  • mypage.html is stored in the folder Alice, in the folder Web Pages, in Root.
  • logo.jpg is stored in the folder IMG, in the folder Resources, in Web Pages, in Root.
  • Write the tag that will display the logo in mypage.html using an absolute url with scheme "http" and port "80".

Now, I (approximately) do most of this:

<img src="http:/webpages/resources/img/logo.jpg">

However I cannot find an example of how or where to specify the port number using a path like this.

Could anyone help point out to me where to include it? (And also if my progress above is actually correct?)

unor
  • 92,415
  • 26
  • 211
  • 360
Jonathan
  • 77
  • 1
  • 12

2 Answers2

3

The port comes directly after the hostname, separated by :.

http://example.com:80/
http://example.com:80/path

Relevant specifications:

Community
  • 1
  • 1
unor
  • 92,415
  • 26
  • 211
  • 360
  • That makes sense, however I'm a little unsure how to apply this to my specific example. Would it be http ://Root:80/webpages/... or http://:80/webpages/... or http ://webpages:80/... ? – Jonathan Apr 20 '17 at 09:16
  • 1
    @Jonathan: The hostname has to come first (and can’t be empty, like in your second example). A hostname is something like `example.com` or `www.example.org` or `localhost` etc. Can’t tell for sure what it should be in your case. But assuming that "webpages" is part of the URL path, it’s likely "root". – unor Apr 20 '17 at 14:43
0

http = Hypertext Transfer Protocol, use port 80 as default. You don't need to put :80 after the domain.

You need '/' after the http protocol:

<img src="http://webpages/resources/img/logo.jpg">

If the image is on the same server, you can use this:

<img src="resources/img/logo.jpg">

You're pointing to the resources folder, if your folder is on a lower folder level, you can use:

<img src="../resources/img/logo.jpg">
luispa
  • 133
  • 3
  • 7
  • 1
    Thanks for your response. I understand that port 80 is the default for http but the question I'm answering seems to request that port 80 is explicitly stated rather than implicitly. – Jonathan Apr 20 '17 at 09:12