0
Please, I just can't understand the difference b/w relative and absolute links in HTML5. Can someone please put me through ?
3 Réponses
+ 3
Check this site:
https://askanydifference.com/difference-between-absolute-and-relative-path/
And here you can see how path look like:
https://www.computerhope.com/issues/ch001708.htm
Absolute start from root directory like C or D drive and it is full path location.
So if you build project and your files are saved on desktop, your apsolute path is something like this (probably little diferent this is just example)
C:/USER/DESKTOP/ProjectName/index.html
But relative is just:
index.html or ./index.html
Relative start from current file directory and you can navigate in directory using dots (.), where ./ is current directory, ../ is directory up...
So if you copy code and paste to diferent device if you use absolute path, you will need to change url(local file path) in every single place you type (even if you host website you may run into problems), so use relative paths to point to file location on your device(or server if you host website)
+ 1
Thanks, PanicS.
+ 1
Absolute is from some other place apart from the initial website.
Relative is something from the website itself