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

HTML How to Make a Website Adding Pages to a Website Add Iconography

Linking CSS to HTML worksheets

I am working from the Front-end web development track, building a website. i have added a class in my html, however this is not picking up in my CSS document so that my styling is not displaying?

Can you paste in the code you have so far?

4 Answers

Christopher is absolutely correct. Class and ID names are case sensitive such that "Selected" and "selected" are two different classes or identifiers.

If you have other CSS stylings applied to the page and those aren't showing up either, you may have a typo within the "" element on your HTML page. The following may sound redundant, but an ounce of prevention is worth a pound of cure. Check to make sure it begins and ends with a < and a >, respectively. Also, make sure that all attributes have an = sign and are enclosed within either double or single quotes like so: " " or ' '. Be sure the name of the CSS page is spelled correctly and that you've put ".css" at the end of the file name.

Make sure to double check your syntax. For instance, In my HTML file, I have: <a href="index.html" class="selected"> this creates the class "selected". In my CSS file, I then typed: nav a.selected { font-color: blah; } this is a selector for the nav link element with the class name "selected", which changes the color to "blah". All the quotation marks and semi-colons and opening and closing brackets in your code have to be in their right place, so I'd double check that, and also your spelling, I believe the class names you create are case sensitive, so class="Selected" is different from class="selected".

You may have mistyped a name of CSS file in html file. You can copy the line below and paste it on your html instead of type it out with a file name replaced. <link rel="stylesheet" type="text/css" href="example.css">

Thanks so much everyone for taking the time to help me! I have sorted this one out!