【问题标题】:text decoration line-through for visited links访问链接的文本装饰线
【发布时间】:2020-11-11 16:28:31
【问题描述】:

我为 Stylish 尝试了此代码的不同变体:

a:visited {
    text-decoration: line-through;
}

对于“直通”访问的链接我需要做什么?

【问题讨论】:

  • 不明白

标签: html css stylish


【解决方案1】:

我通过addEventListener("click"...)找到了这个

document.getElementById("link1").addEventListener("click",function(){
document.getElementById("link1").style.textDecoration = "line-through";
});

document.getElementById("link2").addEventListener("click",function(){
document.getElementById("link2").style.textDecoration = "line-through";
});
<a href="#" id="link1">Link 1</a>
<a href="#" id="link2">Link 2</a>

编辑:警告 text-decoration 由于用户的隐私问题,不允许使用样式。

源代码:https://developer.mozilla.org/en-US/docs/Web/CSS/Privacy_and_the_:visited_selector

访问链接样式的限制

您可以设置已访问链接的样式,但您可以使用的样式有限制。只有以下样式可以应用于访问的链接:

  • 颜色

  • 背景色

  • 边框颜色(及其子属性)

  • 列规则颜色

  • 轮廓颜色

  • 填充和描边属性的颜色部分

【讨论】:

猜你喜欢
  • 2016-05-04
  • 2012-01-30
  • 2020-03-27
  • 2014-05-26
  • 2014-06-08
  • 2019-10-19
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多