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 Getting Started with CSS Adding CSS to a Page

Tiffany Haltom
Tiffany Haltom
6,769 Points

Link for CSS and HTML file not working

So I created the work files in Sublime Text 2 (one under index.html and the other under style.css) and when I use the link element, the two files aren't working when I load it on Chrome, or any other browser. I've gone over the code but I can't seem to fix the problem.

Hi Ravi,

Can you post the <head> section of your html file?

See this guide for how to post code: https://teamtreehouse.com/forum/posting-code-to-the-forum

Are you seeing your unstyled html page in the browser?

Do you have your html and css file in the same folder?

Ken Alger
Ken Alger
Treehouse Teacher

Ravi;

Would you mind posting your code, likely only the <head> section of your HTML is necessary to see the stylesheet links. Also, make sure that the style.css file is in the appropriate file location as is referenced in your <link> tag.

Ken

2 Answers

Tiffany Haltom
Tiffany Haltom
6,769 Points
<head>
<title>Adding CSS</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>

(saved as index.html). I can see the unstyled html in the browser, just not the css

CSS File:

h2 {
    color:steelblue;
    padding-bottom: 10px;
    border-bottom: 2px dotted;
}

ul {
    color: white;
    background-color:steelblue;

}
Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Ravi;

If your style.css is not in the same folder as your index.html you need to adjust that in your <link> line of code.

Ken