样式:访问过的链接 [英] Styling a:visited links

查看:134
本文介绍了样式:访问过的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在文章列表中样式a:已访问的链接。目前这工作正常应用颜色在我的CSS到a:访问的链接,但是,我后来的东西多一点。我想在访问时在文章标题旁边添加一个小点。

I'm looking to style a:visited links in an article list. Currently this works fine with applying a color in my CSS to a:visited links, however, I am after something a little more. I'd like to add a small dot next to the article title when visited.

我做了一些研究,看起来像除了应用颜色之外的任何东西:访问的链接不工作(背景/背景图像支持已被删除,由于隐私问题)所以我想知道是否有任何提示或想法? jQuery?

I've done some research and looks like anything other than applying a color to a:visited links don't work (background/background-images support has been removed due to privacy issues??) so I'm wondering if anyone has any tips or ideas? jQuery?

推荐答案

这个工作,我知道自从我试过一个事实。虽然它似乎无法在Chrome中使用,但它在IE中可以正常工作,所以它不是CSS的问题。

This works, I know that for a fact since I've tried it. Though it doesnt seem to work in Chrome, it works in IE, so it's not a problem with the CSS.

<style>
a:link
{
    color: #f00;
}
a:visited
{
    color: #0f0;
}
a:hover
{ 
    color: #00f;
}
a:active
{
    color: #ff0;
}
</style>
<a href="x" target="_blank">X</a>

因此,请在IE中尝试:

So try this in IE:

a:visited:before
{
     content: ".";
}

如果这不够,您必须添加某种点击事件例如(使用jQuery,但是地狱丑陋):

If this isnt sufficient, you'll have to add some sort of click event to your links and style them from there, for example (uses jQuery, ugly as hell though):

<a href="javascript:void(0)" onclick="$(this).html('.Link');">Link</a>

这篇关于样式:访问过的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆