开发者

CSS: How to put a checkmark icon/acsii character next to all visited links?

For any visited (a:visited) web page, I would like to display those links on m开发者_StackOverflowy 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?


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.


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

source


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜