Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML

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!

-Tommy

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. ;)