Reputation: 7005
This is maybe a kind of dumb question but I never knew why there are 3 ways to write the same.
For instance, show an image called photo1.jpg
inside the img
dir:
index.html
<img src="images/img_1.jpg" alt="photo 1" />
<img src="/images/img_1.jpg" alt="photo 1" />
<img src="./images/img_1.jpg" alt="photo 1" />
Those 3 work but is one better than the other? why?
Edit, as some pointed out, the second one is an absolute path.
In that case what I want to know is what differences are between 1 or 3. Or they are interchangeable?
Upvotes: 1
Views: 57
Reputation: 7928
As far as I know, the second one is not a relative path, images should be in the root folder.
The first and the third one are the same, dot represents current folder.
Upvotes: 1