HTML Different link type Question -
what difference between? thank you.
<img src="images/file.jpg"></img>  between  <img src="/images/file.jpg"></img>  between  <img src="./images/file.jpg"></img>  between  <img src="../images/file.jpg"></img>      
you need learn relative , absolute paths.
here explanations examples, realy should read link in order understand concepts.
if base url "http://example.com/resources/" then:
<img src="images/file.jpg"></img>   will get:
http://example.com/resources/images/file.jpg   it adds src url base url.
<img src="/images/file.jpg"></img>   will get:
http://example.com/images/file.jpg   bacuse image url rooted (starts /) uses domain , adds image src domain.
<img src="./images/file.jpg"></img>   will get:
http://example.com/resource/images/file.jpg   in case, uses relative path current directory (.), base directory (resources).
<img src="../images/file.jpg"></img>   will get:
http://example.com/images/file.jpg   in case, uses relative path parent directory (..), makes go directory , add rest of path.
Comments
Post a Comment