Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML HTML Basics Going Further with HTML Root-relative Paths

Shadab Khan
Shadab Khan
5,470 Points

Root vs Relative link

Hi, I am not clear on when should I use root link vs relative link when building website? If I opt for a relative link, will there be any issue when I deploy the pages and folder to the live server? Please advise as I am trying to clarify this concept before moving further.

Thanks. Shadab.

2 Answers

Hi Shadav,

first answer: No, there will be no issues with the relative paths when you deploy it to the server.

I would reccomend the relative file path as I have used it for all my websites so far.

I am sure there are circumstances when the root relative paths are wiser but I think you will not encounter them too soon. I can imagine that if you have very large projects with complex file order systems then it could make sense to use it.

But maybe someone else knows a situation where it makes sense to use root relative paths.

Hope that helps.

Happy coding, Nils

Shadab Khan
Shadab Khan
5,470 Points

Thanks Nils, much appreciated.