Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML How to Make a Website Creating HTML Content Build the Footer

What do relative links mean compared to absolute links?

I'm doing the exercises How to Make a Website and they're explaining the part to when and when not to use an absolute link or a relative link. I still don't quite get it.

2 Answers

Kevin VanConant
Kevin VanConant
1,833 Points

Relative links are linked to files in your file system. Use relative links whenever you can. If you link everything to outside links and say the other website goes down or they remove the file you were linked too, your link inside your website will break.

Relative is files you host in your file system Absolute you link to another website.

Absolute you use to link to other websites. If you are advertising and link to someone elses website you would absolute link to their website.

Hope this helps explain it a little more!

Happy Coding!

Relative links are links (usually internal to your domain) that are referenced realtive to the current file location.

<img src="images/picture.jpg">would look for a folder called images in the SAME folder that the current file is in and then lookin for picture.jpg in the images file.

<img src="../images/picture.jpg"> looks 'one folder level up' for the images folder.

Absolute links are full http links, usually to external sources.

<a href="http://www.facebook.com/yournamehere">