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

Nathaniel Nasarow
Nathaniel Nasarow
10,291 Points

Disabled won't change color of a nav link?

First, code! (shortened for clarity)

HTML:

<nav> <ul> <li><a href="about.html" disabled>About</a></li> <li><a href="contact.html">Contact</a></li>

CSS:

a[href$=".html"]:disabled { background-color:#fff; }

The object of this is to make the specific link to turn white after it's selected, and prevent it from being clickable. However, that is not the case here. The color remains its original (which is orange) and I can still hover over it and click it.

Any suggestions, or am I using this particular bit of code incorrectly?

1 Answer

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

I was confused about this myself when I tested the code, then it occurred to me that the disabled attribute is used for form elements to disable radio buttons and checkboxes. I don't thunk it can be used for hyperlinks.