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

General Discussion

Styling with CSS

I have 2 div classes for links in my webpage. The first is for my general nav links which will go across the top of my page and the 2nd is for my quicklinks which run down the left hand side of the page. Then I have various links within the text of each paragraph on the page. The HTML looks like this

<div class="nav">

<a href="various_pages.html">text</a>


<div class="quicklinks">

<a href="various_pages.html">text</a>


I want to style my "nav" class with no underline neither on hover, activate, focus nor on visited. For my "quicklinks" class I want the underline on hover, activate and focus. In neither case do I want any colour change. I then want the remaining links in the document to be styled in the same way as my "quicklinks".

My CSS looks like this: -

a:link {color: #364467; text-decoration: none}
a:visited {color: #364467; text-decoration: none}
a:hover {text-decoration: underline}
a:active {text-decoration: underline}
a:focus {text-decoration: underline}

a.nav:link {color: #364467; text-decoration: none}
a.nav:visited {color: #364467; text-decoration: none}
a.nav:hover {text-decoration: none}
a.nav:active {text-decoration: none}
a.nav:focus {text-decoration: none}

BUT, my "nav" links just look like everything else i.e. they still have the underline on hover, active and focus.

Can't figure this out.


2 Answers


All sorted.