15. Links


So I am here just wondering about something. Whenever I use the 'a:visited' the link doesn't have to be visited, It automaticly is visited. For example:

HTML Code:

<!DOCTYPE html>
		<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
			<a href="http://www.codecademy.com">Codecademy</a>
			<a href="http://www.codecademy.com">Codecademy</a>
			<a href="http://www.codecademy.com">Codecademy</a>

CSS Code:

a:link {

a:hover {
a:visited {

The 'codecademy' links are always orange, no matter if I hover over them, click them, they are always orange. Any help?


i would like to see you html code

if you edit/update your question, leave a reply so i get a notification. Your html code is not visible, take the following steps to make your code visible:

select your code and press ctrl + k (or cmd + k if you use a mac)

if this instructions are unclear, you can also insert 3 backticks before and after your code, like so:


the backtick is located above the tab key on your keyboard


Here, I edited it. .


The links are compared to your browser history, so it make sense they all are color #EE9A00

for a:hover to work, a:hover should be after a:visited:

a:visited {
a:hover {

you don't have a click event? That would be a:active, you should that one as last.


thank you very much.


thanks it was agreat help!!! i was stuck there for a great lot of time ,but does this means that a:hover is placed before a:visited by default as in it is given according to syntax or is this related to some way in which css interprets these elements.


i am confused by that, you write the code, so you place a:hover before a:visited. css uses a point system (if you want i can give you an extensive article on this). Lets look at this example, now take it from me these two css selectors have the same amount of points. If the points are equal, css decide based on order, the last rule is applied. If you where to swap them, the text will become red.

You have the same with a:visited and a:hover, they are also equal in points, so order matters. Make sense?


thanks a lot that really clears a lot for me ,i was really stuck thinking about the problem in this exercise thanks once again.


2 posts were split to a new topic: 15. links