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

short file path isn't working

In the videos the teachers seem to be using relatively short file paths and they're working. I'm building a site with files on my computer and I've noticed I need to use a longer file path for my css style sheet to link in to my html sheet. I have all my html files and my main css style sheet in a portfolio folder. If I shorten the file path /Users/Brandon/Documents/portfolio/main.css in my link tag, the link fails. I'm a little confused do these short file paths only work on workspaces or should I be doing something different?

1 Answer

Hi Brandon,

The way you structure your project will determin how you will have to link through to each element.

For example for your project I would create a main directory called portfolio, then inside this directory I would then create 2 separate folders one called img (where images are stored) and one called css (for you style sheets).

You would then have your index.html file located inside the portfolio folder along side the css folders and img folders.

When linking to your css file in your editor you would then use a link that looks something like

<link rel="stylesheet" type="text/css" href="css/main.css">

I hope this helps

yeah thanks! I had the files loose in documents which thought was just a default folder.