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

HTML How to Make a Website Customizing Colors and Fonts Use Classes in CSS

nav a.selected not working

Hello,

I can't seem to get the word "Portfolio" to be dark green at all times (or in other words, my nav a.selected doesn't seem to be working). Here's my html:

<body> <header> <a href="index.html" id="logo"> <h1>Riley Gault</h1> <h2>Software Engineer</h2> </a> <nav> <ul> <li><a href="index.html" class="selected">Portfolio</a></li> <li><a href="about.html">About</a></li> <li><a href="contact.html">Contact</a></li> </ul> </nav> </header>

And my CSS:

a{ color: #6ab47b } header{ background: #6ab47b; border-color:#599a68; }

h1, h2{ color: #fff; }

nav{ background: #599a68; }

nav a, nav a:visited{ color:#fff; }

nav a.selected, nav a:hover { color:#32673f; }

Thanks for the help!!

2 Answers

This is magically fixed. I didn't change anything, just refreshed the page one more time and it worked! Thanks anyways!

Pat Rik
Pat Rik
304 Points

same issue here, but refreshing doesn't work... here is what i coded, made I didn't get sth.

html: <nav> <ul> <li><a href="index.html" class:"selected">Portfolio</a></li>

css: nav a.selected, nav a:hover { color: #32673f; }

pat barosy
pat barosy
6,759 Points

It should be class="selected". Remove the colon & replace it with an equal sign