Please, I just can't understand the difference b/w relative and absolute links in HTML5. Can someone please put me through ? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

Please, I just can't understand the difference b/w relative and absolute links in HTML5. Can someone please put me through ?

7th Aug 2022, 12:14 AM
Ogbonna Noble
3 Antworten
+ 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)
7th Aug 2022, 12:40 AM
PanicS
PanicS - avatar
+ 1
Thanks, PanicS.
7th Aug 2022, 12:20 PM
Ogbonna Noble
+ 1
Absolute is from some other place apart from the initial website. Relative is something from the website itself
8th Aug 2022, 9:09 AM
Jherry Okeke
Jherry Okeke - avatar