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 trialZach Saul
11,156 PointsVisited links changing colors without creating a "visited" pseudo class?
not sure I completely understand why it is that when (at around 2:30 in this video) you select anchor elements with the psudo-class link
a: link { color: red; }
that the result is the browser restoring it's default styles (the purple) after the user has clicked on it.
is it the case that the browser default already has some sort of mechanism for determining whether a link has been clicked or not? because from my assessment (using only the code in these project files) we have not given the browser any instructions on how to differentiate between visited and non-visited pages.
hope you guys can clarify,
3 Answers
George Cristian Manea
30,787 PointsEvery browser has this user agent CSS. When you visit a link it will make it automaticaly purple. The :link selector is used to select unvisited links.
George Cristian Manea
30,787 PointsYes. but if you want to overwrite you can use this a:visited{color:red;}
Zach Saul
11,156 PointsOk thanks George! I realize now that i was over analyzing pseudo class functionality and its a lot more straight forward than I might have thought
Zach Saul
11,156 Pointsso essentially what you're saying is the browser and/or CSS already understands how to differentiate between visited and unvisited links without me as a coder having to do anything, right?
Zach Saul
11,156 PointsZach Saul
11,156 Pointsso essentially what you're saying is the browser and/or CSS already understands how to differentiate between visited and unvisited links without me as a coder having to do anything, right?