equivalently

What is the difference between src = "/images/logo.gif" and src = "images / logo.gif"?

  <img src = "images / logo.gif" />

equivalently

  <img src = "./ images / logo.gif" />

But

  <img src = "/ images / logo.gif" />

is different.

Where is the third element looking for logo.gif?

+6
html
source share
3 answers

<strong> images /logo.gif

Relatively, it means: go to the folder with images, and then get the logo.gif resource

<strong> ./images/logo.gif

Relatively, it means: from the current folder (the dot means this), go to the folder with images, and then get the logo.gif resource

As you can see, the first two mean the same thing, finally the last

/images/logo.gif

Absolutely, it means: from the root of the web server or file system or something else (slash means this), go to the folder with images, and then get the logo.gif resource

+7
source share

The third one looks relative to the root of the site, so if you were on the page at:

http://entrian.com/somewhere/page.html 

it will look in:

 http://entrian.com/images/logo.gif 

ignoring a fragment of a page somewhere .

+10
source share

In the root document. The first two are relative paths, and the last is an absolute path.

0
source share

All Articles