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

CSS CSS Foundations Selectors Type Selectors

Brendan McCarthy
Brendan McCarthy
2,854 Points

Organizing Sublime Text

Hey Treehouse,

So I just downloaded Sublime Text 2 and I'm having trouble linking my style.css file to my index.html file. Do my files have to be in the same folder? Is there a specific way to organize them in ST2? I know my <link rel="stylesheet" href="style.css"> is typed correctly, so what could I be doing wrong? Thanks in advance for your help!

Best, Brendan

3 Answers

Dean Wagman
Dean Wagman
21,591 Points

The href attribute specifies where the CSS file is located in the file structure of your website. If it is located in the same folder (also known as a directory) as the index.html file you can just specify its name; ie "style.css" or whatever you named the file. This is what we call "relative" linking. As you are telling the browser where the file is, relative to the file you are in.

If the file where to be in a folder within the folder you are currently in:

my-website (folder)
|                 \
index.html    styles (folder)
                     |
                    style.css

Then you would need to tell the browser to look within that folder for the file. In this example that would equate to:

<link rel="stylesheet" href="styles/style.css">

There are more advanced instances where you would need to tell the browser to exit the folder(directory) you're currently in and navigate to its parent folder(directory) a level up. To do this, you type two periods ".." before the file:

my-website (folder)
|                    \
about(folder)    styles (folder)
|                         |
index.html        style.css

In this case the link tag would look as followed:

<link rel="stylesheet" href="../styles/style.css">
Dean Wagman
Dean Wagman
21,591 Points

No Problem, let me know if you me to help you through anything else. :]

Brendan McCarthy
Brendan McCarthy
2,854 Points

Thanks again! I'm going to recommend to Treehouse some kind of "friending" system within the website community.

Dean Wagman
Dean Wagman
21,591 Points

I'm a pretty active twitter user. You could always just shoot me a message @deanwagman

Dean Wagman
Dean Wagman
21,591 Points

I'm a pretty active twitter user. You could always just shoot me a message @deanwagman

Brendan McCarthy
Brendan McCarthy
2,854 Points

thanks! I appreciate it. my handle is @teledeluxe72