css - Find image path using html -


this path of html file ie test.html

/var/www/html/1/2/3/4/5/6/7/8/9/test.html 

i want images path:

/var/www/html/1/2/3/4 

how able in img tag, src attribute.

you should take @ absolute , relative paths

in case writing <img src="."/> current path it's equivalent /var/www/html/1/2/3/4/5/6/7/8/9/test.html (. means current directory)

now can go directories using ".." can move desired path using method : <img src="../../../../../img.jpg">

these 2 methods called relative paths , that's should use in websites since can have migrate website , absolute paths wouldn't work anymore

for example if write <img src="http://html/1/2/3/4/img.jpg"/> still work if site named "html" , directory logic stays same

hope helped !


Comments

Popular posts from this blog

android - How to save instance state of selected radiobutton on menu -

python 3 IndexError: list index out of range -

IF statement in MySQL trigger -