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

Maritza Nguyen
Maritza Nguyen
1,683 Points

Problems linking my CSS file to my index.html

I am using windows and Sublime Text 2. I am also trying to learn this text editor since it's new to me. Currently I am studying the CSS Foundations Dive. I am about to start "Selectors" but it is not use to continue if I don't know what I am doing wrong. This may seem a stupid question but I can't get the css file to link and affect the index.html file. How can I save it? Is there anything that I need to download in order for this two files to link. I am so frustrated because this is holding me back from continuing my lessons. Please explain it to me like I am a 5 year old :). I would appreciate your help so so much.

7 Answers

Christine Villa
Christine Villa
5,273 Points

Okay. Is your style sheet located within a folder called css?

Christine Villa
Christine Villa
5,273 Points

First I would check to make sure that the link to your css is properly written in the "head" section of your html.

For example: <link rel="stylesheet" type="text/css" href="style.css">

Check to make sure that your syntax is correct. Missing one little bracket can throw the whole thing off.

Second, I would make sure that you've written the correct path to your file. So let's say I was starting from scratch. First I would create a new folder on my desktop and call it something simple like "My Website." I would then make sure I save both my css and html file within this folder. Then I would link my html to my css with the above code.

However, if I saved my css within another folder, then it gets a little bit tricky. There's no problem doing that, it's just you have to do a little extra to the code above so your computer knows where to find it.

Christine Villa
Christine Villa
5,273 Points

Sorry, it didn't show my example above. Hopefully it will show here.

link rel="stylesheet" type="text/css" href="css/normalize.css"

don't forget the angle brackets on either side!

Maritza Nguyen
Maritza Nguyen
1,683 Points

This is what I got and this is according to the video lesson.

<head> <title>Adding CSS</title> <link rel="stylesheet" href="css/style.css"> </head>

Maritza Nguyen
Maritza Nguyen
1,683 Points

link rel="stylesheet" href="css/style.css" with the open and closing brackets

Maritza Nguyen
Maritza Nguyen
1,683 Points

I've found out what I was doing wrong Christine. Thank you for your help!

Alex Nikdel
Alex Nikdel
4,546 Points

What did you do wrong? I'm having the same problem and I can't seem to resolve it...