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 Class and ID Selectors

css not working

Can anyone please tell me what is wrong with this code? I keep hitting refresh page and nothing happens. I opened it in several browsers, and all i get is the html page; the css is not applied. I'm using sublime text 2. Thanks.

HTML: <div class="container"></div>

CSS: .container { width: 740px; margin: auto; }

5 Answers

Kristopher Keen
Kristopher Keen
9,992 Points

Hi Cecil. Try downloading the Project files to see what is there. For the video, Class and ID selectors that you have marked in your question, they have the starting files and the final files. That should give you an idea of what is wrong specifically. If that doesn't help, please try and be more detailed in your question as it is hard to tell exactly the issue you are having by what is written above.

.container { margin: auto; width: 740px; }

The code above is from the final CSS file and it is exactly as you have written it in your question.

Kristopher Keen
Kristopher Keen
9,992 Points

Also, try looking at the video on the right hand side, "Tips for asking questions" This will allow you to include the code specifically like you have it written in Sublime text 2.

See the difference in the CSS code show in your question and my first answer.

'''CSS .container { margin: auto; width: 740px; }'''

Kristopher Keen
Kristopher Keen
9,992 Points

See i even got it wrong to begin with. Trying it again, they are "backticks". It is same key as the " ~ ". Trying it again.

.container {
    margin: auto;
    width: 740px;
}
David Holt
David Holt
14,540 Points

Could you provide any HTML?, there may be a simple mistake in your general markup.

yes, it was a simple folder mistake. it was pointing to an empty folder thanks.