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 Color in CSS

Richard Owens
Richard Owens
1,071 Points

I dont understand what nav a:visited code does to make the links turn white. Can someone explain it?

nav a:visited

2 Answers

Blake White
Blake White
5,232 Points

He combines two things in one, and uses something you have not seen before in this video. Here is how it works.

nav a, nav a:visited {
  color: #fff;
}

is the equivalent of

nav a {
  color: #fff;
}
nav a:visited {
  color: #fff;
}

You can change the color value of either in the second one to help clarify what is happening. Your browser has a default style for visited links, usually a darker purple color. We are overriding that with the a:visited, but only for the anchors within the nav tags.

Let me know if that doesn't clear it up enough.

Nate Conley
Nate Conley
16,191 Points

The visited pseudo-class in CSS is triggered when you have visited a link. If, in your CSS, you set that element to white, it will turn white after you have, in fact, clicked on it, and visited the page.