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

I am having problems with the nav element in How to make a website. Any help would be great.

How do you set the color of anchor elements inside the nav element to white using a Hexadicemal value? I understand the nav a part, but I don't understand the nav a:visited .

p { color: #000000; } nav a., nav a:visited { color: #fff; }

4 Answers

Hi Lee,

I will assume that you have the following:

<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
    <nav>
        <ul>
            <li><a href="#">One</a></li>
            <li><a href="#">Two</a></li>
            <li><a href="#">Three</a></li>
            <li><a href="#">Four</a></li>
        </ul>
    </nav>
</body>
</html>

If you want affect all of the anchor tag inside of the nav tag you should do:

nav a{
    color: #FFFFFF;
}

About a:visited, I will respond this with a question. What usually happen when you click on a link in Google? The color changes to a light purple. That is because you already visited that site. This let you know that you've been there before. So if you do:

a:visited{
    color: red;
}

After you click on the link and go back, the color should be red. If you still don't get it post back. I can try to come up with something different.

-Dan

Dan, Thanks for a quick response.

L.

Did you get it?

Hopefully I'm answering what you're asking. The nav a:visited will change the color of the link when someone clicks on it. So if the website is fresh and no links are click it would be say black, but once it's clicked the nav a:visited would change it to say green. On the code that you've presented you have the nav a, nav a:visited. So they are linked to the same color because you used a comma. If you want a different color then you need to separate them like so:

nav a {color: #000} //This is an example color of black

nav a:visited { color: #fff}

Yes, thanks for your time Scott Crawford. Makes sense.

Why there is no . after the a?

Because the period is a CSS class selector. Check this: http://www.w3schools.com/cssref/sel_class.asp

Yes, thanks for your time Daniel Santos.