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

Tobi Ogunnaike
Tobi Ogunnaike
2,242 Points

Basic CSS not working.. need help to fix code

/*************************** NAV ***************************/

/Nav background on mobile/ nav{ text-align:center; padding:10px 0; margin: 20px 0 0 ; }

nav ul{ list-style:none; margin:0 10px; padding:0; }

nav li{ display:inline-block; }

/Nav link/ nav.a, nav a:visited} color:#fff; }

/*Selected nav link */ nav a.selected,nav a:hover{ color:#000; }

The last 2 bits of code are not working- the nav.a and nav a:visited, and the nav a.selected, nav a:hover.

Can you help me figure out why?

Thanks

2 Answers

Navid Mirzaie Milani
Navid Mirzaie Milani
6,274 Points

it isn't nav.a it is nav a first of all like nav a:hover and nav a:selected ;)

thus.

nav a {
   color:red;
   etc.
}

nav a:hover {
   color:orange;
}

nav a:selected {
  color:purple;
}

if you say nav.a then the html looks like

<a href="foo.html"  class="a">bla</a>
Tobi Ogunnaike
Tobi Ogunnaike
2,242 Points

Thanks! Just changed it and it works.

Not sure what you're trying to explain the second bit of code?

As Navid Mirzaie Milani mentioned:

<a href="foo.html"  class="a">bla</a>

This will refer to a class called 'a'. CSS Selectors are easy to mix up. I do it all the time :)

Tobi Ogunnaike
Tobi Ogunnaike
2,242 Points

Haha thanks.

Not sure what you mean by this bit of code you posted though. What is that?