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 Classes not working on stage 5 of the CSS part of the Web design starting course.

I've been trying to get CSS classes to work but for some reason, even though the syntax is correct, it is not working. The hover pseudo-class works just fine, but the classes themselves aren't changing with my code.

This is what is written now (minus blanks):

HTML: a href="____" class="test"

CSS: nav a.test, nav a:hover { color: #85FFFF; }

I have tried using the same syntax to set up other classes, and have had no result. Not sure what I am doing wrong here.

EDIT: Ok so it randomly decided to work, not sure why it wasn't before, because I changed nothing in the meantime. Can anyone shed some light on why this was not working before?

Hi Will,

I'm not sure. Maybe you didn't save and refresh? Or you were seeing a cached version of the page before you added the class?

Becky Castle
Becky Castle
15,294 Points

Hi Will, Usually when you're referencing a class using CSS, you'll want to write the class name first and then the element selector. Like this:

.test nav a,
.test nav a:hover {
        color:#85ffff;
}