views:

219

answers:

3

For any visited (a:visited) web page, I would like to display those links on my website with a small checkmark to the left of the link.

So for example:

"this is an unvisited link"

√ "this is a visited link"

Question: how do I accomplish the checkmark using CSS?

+1  A: 

You could use :before pseudo selector, but it's not well supported.

For better support, make it an image, and set it to background-image. Then use padding to show the image.

alex
::before and ::after pseudoelements are well supported in modern browsers, but not supported at all in IE 6 and before. Sometimes that doesn't matter.
Anonymous
Yeh. Pretty sure it's not supported in IE7 too http://www.quirksmode.org/css/beforeafter.html
alex
If IE 8 is coming through WU to XP, almost anybody who got IE 7 pushed to them already got IE 8. (Of course, institutional are the wild card.)
Anonymous
+6  A: 

You can use a combination of background and padding to get this effect.

a:visited {
    background: transparent url("path/to/checkmark.png") left center no-repeat;
    padding-left: 10px;
}

Adjust the padding, and background position to fit your needs. Hope this helps.

nickelleon
+2  A: 
a:visited:before {
    content: "\00A0\221A";
}

source

Knu