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

General Discussion

Relative Links

I am currently working on relative links in HTML and I am unable to link to a file that is in a different folder. Is this because I am working in notepad and there isn't a way to create a file structure ? Should I be using a different text editor ?

9 Answers

edward diamond Can you give an example of what's happening?

edward diamond Put all of your files into the same folder if you use a linking structure like this:

<link src="file.css" />

To start from your domain name (or Root folder) and then drill down, use a structure like the following:

<link src="/css/file.css" />

That slash means that the starting point is the very root folder, to the left of the slash, and imagine the path as the root folder and the link put together.

If you use the double dot method ( ../ )

then it means that the path goes one level up the tree and then starts drilling back down.

The text editor doesn't have anything to do with the code that it writes, so you're safe there. Are you building on a local environment, on a server, or just in a folder on your computer? If you can explain your file structure a little better, everyone can get a better picture of the specific problem you are facing.

edward diamond One thing to note - if you're opening the page on your computer in the browser off of disk (i.e. without a web server) then basing urls off of the root (starting urls with /) won't work for you.

edward diamond - Check out this explanation of absolute vs relative paths.

If you are still confused after reading that tutorial, post a screenshot of your file structure and we can try to provide more specific advice on your file paths.

I have taken a screenshot using the snipping tool of the two separate directories that I am trying to link that are on my desktop but don't know how to post the screenshot on the forum. Please advise. Tried cutting and pasting but that didn't work

Responding to James Barnett about my problem with relative links :

I have taken a screenshot using the snipping tool of the two separate directories that I am trying to link that are on my desktop but don't know how to post the screenshot on the forum. Please advise. Tried cutting and pasting but that didn't work

edward diamond - To put a screenshot in a forum post you first need to upload it using imgur.com then you need to use markdown to embed it into the forum using the syntax ![alt text](/path/to/img.jpg "Title")

Ok I am not sure I totally got what you were saying.Below is what I tried out

![alt text] [/path/to/img.jpg "Capture"

James Barnett, please refer to my previous post. Can you please breakdown your response regarding uploading a screenshot using imgur.com