<img src ="img.png"> in this code - is path of image is relative or absolute and why? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

<img src ="img.png"> in this code - is path of image is relative or absolute and why?

6th Dec 2021, 1:27 PM
Sagar Kushwaha
Sagar Kushwaha - avatar
4 Answers
+ 3
An absolute path consists of protocol (http, https, ftp etc.), followed by domain, and optionally physical path to the resource. A relative path uses the current path as the base, and goes up/down the directory structure the by use of .. (double dot) symbol (where applicable). A mere filename with no path specified may be considered a relative path cause it doesn't specify the protocol, domain etc. like an absolute path does. Hope I get it right ...
6th Dec 2021, 1:46 PM
Ipang
+ 4
Sancho Godinho Thank you for answering but it's not I am asking My question is path(src) of image file is relative or absolute
6th Dec 2021, 1:33 PM
Sagar Kushwaha
Sagar Kushwaha - avatar
+ 4
Ipang thank you for answering
6th Dec 2021, 4:35 PM
Sagar Kushwaha
Sagar Kushwaha - avatar
+ 2
By Default, The Object Remains In Relative Position. Also, If You Want To Make The Position Absolute, You Have To: <style> img{ position: absolute; } </style> So, The Image Is Currently Relative...
6th Dec 2021, 1:29 PM
Sancho Godinho
Sancho Godinho - avatar