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.

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,724 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,724 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?