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!

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


linking stylesheet

I am having trouble linking my css page to my index.html page; what do I need to do? Here is the code:

<!DOCTYPE html> <html> <head> <link rel="stylesheet" href="css/styles.css"> <meta charset="utf-8"> <title>Matt Bloomer| Designer</title> </head>

2 Answers

Thomas Noe
Thomas Noe
12,486 Points

Hi Matt,

Here are some things to try:

1) Make sure the <link> tag is contained inside of a <head> tag, which is also inside of an <html> tag (didn't see the tags in your code, so just wanted to make sure you had this covered).

2) Make sure the relative URL in your href attribute is pointing to a valid location (i.e. does css/styles.css exist?).

3) Check to see if your CSS is selecting the correct components of your page. If steps 1 and 2 are OK, you may have the CSS file linked to your page, but may not be using your CSS selectors correctly, or could have a typo in a selector.

Hope this helps!


The DOCTYPE and Meta must come before anythin on your code. After you'll need a <head>, and inside it you put the link to your stylesheet. If you still need help, post all you code here. ;)