造型访问属于类的链接 [英] styling visited links belonging to a class

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

问题描述

我找不到一种方式来风格 a:visited ,但只有那些属于 .extern

I cannot find a way to style a:visited but only those belonging to .extern.

a:visited.extern 不起作用,也不会 a.extern:visited (我使用Mozilla Firefox 43.0.1 for Linux x86_64)

a:visited.extern doesn't work and neither does a.extern:visited (I' using Mozilla Firefox 43.0.1 for Linux x86_64)

原因是我有一个小图标我想添加到 .extern 链接,我想在链接被访问时更改其 url()

The reason is I have a small icon I'd like to add to .extern links, and I want to change its url() when the link is visited.

<style>
    a.extern {
        padding-right:1.3em;
        background-repeat: no-repeat;
        background-attachment: scroll;
        background-position: right center;
        background-clip: border-box;
        background-origin: padding-box;
        background-size: 0.7em 0.7em;
        background-image: url("img/link.png");
    }

    a:visited:extern {
        background-image:url("img/link-visited.png");
    }

    a.extern:visited {
        background-image:url("img/link-visited.png");
    }
</style>

最后,所有此类型的已访问链接都应受影响 p>

In the end all visited links of this type should be affected

<a class="extern" href="http://etc.etc.etc">link</a>


推荐答案

基本上你想做的是受浏览器,特别是Firefox。

Basically what you want to do is restricted by browsers, particularly Firefox.

每个MDN - 隐私权和:访问过的选择器


以视觉方式呈现访问的链接,但现在对于可以使用的样式有限制。只有以下属性可以应用到已访问的链接:

You will still be able to visually style visited links, but there are now limits on what styles you can use. Only the following properties can be applied to visited links:


  • 颜色

  • li>
  • border-color(及其子属性)

  • outline-color

  • 和笔触属性

  • color
  • background-color
  • border-color (and its sub-properties)
  • outline-color
  • The color parts of the fill and stroke properties

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

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