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
hi1811
1,430 PointsWhat do you add "nav a:visited" for?
I tried typing nav a { color: #fff; } instead of "nav a, nav a:visited", and both visited and unvisited links became white. Now I don't understand what I need to add "nav a:visited" for.
hi1811
1,430 PointsIn the video, I was told to write nav a, nav a:visited { color: #fff; }. My question whether this makes sense. It seems to me that "nav a" alone changes the color of all the links (including those visited).
Yan Liu
10,552 Pointsif you can remember that previously, you have also given
a {
text-decoration: none;
}
without this, when you only write what you mentioned, the visited would be not in white but as default purple colour with underline.
2 Answers
Yorvin Apolinar Luna Wisky
5,791 Pointsa:visited { background-color: yellow; }
This means what if a user clicks on link, its color will change to yellow. PD: Excuse me for my english :/
Garrett Levine
20,305 PointsUnless you change the stated of visited link color, then once you visit a link, it will always change to that inherent purple color. With the code you are required to use;
nav a,
nav a:visited {
color: yellow;
}
all links will always be yellow, where as just changing the the color of 'nav a' will result in the links being yellow UNTIL they are visited.
hi1811
1,430 PointsThat's what I'd expected, but it's apparently not the case.
http://port-80-kfjdfr0r2g.treehouse-app.com/test1/ All the texts look yellow, even after visiting links.
Garrett Levine
20,305 Pointsyes, with this code, that is what will happen. The code will be yellow even after visiting the links.
Yan Liu
10,552 PointsYan Liu
10,552 Pointsnav a:visited means when the link has been visited, and it takes whatever css you put into that property.