Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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