html - img tag not working with relative path in src -
this not working:
<img src="../assets/images/image.jpg" alt="alternative text">
but working:
<img src="http://localhost/abc/def/geh/assets/images/image.jpg" alt="alternative text">
in scenario, cannot work absolute path. have use relative path.
"../assets/images/image.jpg" -this means
- '../' go 1 directory now
- find 'assets/' folder
- find 'images' folder
- find 'image.jpg' file.
that relative link work if page in subfolder in
"http://localhost/abc/def/geh/"
if location of page
"localhost/asdf/asdf/asdf/asdf/index.php"
(which seems ridiculous) assets folder relatively have go way root.
'../../../../abc/deh/geh/assets/images/image.jpg;
alternatively use base tag in head tag make url in actual src attribute more friendly.
Comments
Post a Comment