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.

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.