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 How to Make a Website Customizing Colors and Fonts Use Classes in CSS

Use classes in CSS

<ul>
                    <!--anchor element is a child to list element here.-->
                    <li><a href="index.html" class="select">Projects</a></li>
                    <a href="about.html" class="select"><li>About</li></a>
                    <li><a href="contact.html" class="select">Contact</a></li>
 <ul>
nav a.select, nav a:hover{
    color: #32673f;
}

I do not understand this bit. Can anyone here explain me please?

Thanks in advance,

Regards,

Karthikeyan P

2 Answers

geoffrey
geoffrey
28,736 Points

You are totally right, try to apply another color such as #FFF as exemple, when mouse is hovering anchors. Then in this case the color will switch to #32673f to #FFF. You got it ! :)

geoffrey
geoffrey
28,736 Points

You apply the color #32673f to all anchors nested inside nav tags where there is the "select" class applied then you have a comma and another selector, that simply means you'll apply the same rule to the other selector, which is here nav a:hover.

In this case, when your mouse is hovering all anchors nested inside nav tags.

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

        /*It's the same as, this, but we should avoid to repeat*/

        nav a.select{
           color: #32673f;
        }

       nav a:hover{
           color: #32673f;
       }

In HTML, I have added classes to all anchor elements inside nav element with class name "select".

In CSS, I applied color property and value to #32673f to "select" class name and hover state on anchor element inside nav.

Simply there will no change right in this case. right?