0

What is the difference between relative and absolute path ?

27th Dec 2022, 2:13 PM
Trishant Mishra
Trishant Mishra - avatar
1 Resposta
+ 2
Imagine you have 2 files in your folder. One file is your index.html , and the other one is style.css . If you want to link css file to html, you would write: <link rel='stylesheet' href='style.css'> If you want to put an image in your index.html — where the image is from the internet you would write: <a href='https://youtube.com/watch?/path-to-a-video'>Watch my latest YouTube video</a> In other words, relative URL (uniform resource locator) path is a path that link to files within your directory (other files that you have in your folder, which you link to each other) — First example Absolute path is the one, which links to external webpages, i.e. something which can not be linked through relative path, e.g. you can not link someone's webpage just be typing webpage's relative path. Since it wouldn't work on your index.html as you do not have the HTML file you're trying to link, therefore it's absolute — Second example
27th Dec 2022, 2:21 PM
Lamron
Lamron - avatar