Why doesn't my visited link have a background color?

It seems that a: visited will not show the background color in my links.

http://jsfiddle.net/davestein/D2srA/

What super simple thing am I missing?

+4
source share
5 answers

The background color only on a:visited works (as Dave said above, in FF, Chrome and Safari), if regular a has a background color, either explicitly defined or through inheritance (the direct parent should actually have a background color so that it is the truth).

Obviously, it is not always necessary to determine the background color for a all the time, since the site may have a background image.

CSS error ..?

+5
source

try a) set the default background color (for example, #fff) and b) delete! important as shown below:

http://jsfiddle.net/D2srA/10/

+3
source

I'm not sure about the technical reason here, but this seems to work for me if I add a background color for:

a {background-color: #ffffff; }

a: visited {background-color: # ff0000; }

+1
source

it does not work for me if I do it the way you do. But if I add every pseudo-class, it will work. For instance:

  a: link {color: # FF0000;} / * unvisited link * /
 a: visited {color: # 00FF00;} / * visited link * /
 a: hover {color: # FF00FF;  background-color: black;} / * mouse over link * /
 a: active {color: # 0000FF;} / * selected link * /
0
source

! Always important truck

 a:active {color:#0000FF !important;} a:visited {color:#0000FF !important;} 
0
source

All Articles