简体   繁体   English

已访问链接的文本修饰线

[英]text decoration line-through for visited links

I tried different variations of this code fo Stylish:我为 Stylish 尝试了此代码的不同变体:

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

What i need to do for "line-through" visited links?我需要为“直通”访问的链接做什么?

I found this by using addEventListener("click"...)我通过使用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>

EDIT: Warning text-decoration styling is not permitted due to the user's privacy issues.编辑:由于用户的隐私问题,警告text-decoration样式是不允许的。

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

Limits to visited link styles限制访问链接 styles

You can style visited links, but there are limits to which styles you can use.您可以设置已访问链接的样式,但您可以使用的 styles 是有限制的。 Only the following styles can be applied to visited links:只有下面的 styles 可以应用于访问过的链接:

  • color颜色

  • background-color背景颜色

  • border-color (and its sub-properties)边框颜色(及其子属性)

  • column-rule-color列规则颜色

  • outline-color轮廓颜色

  • The color parts of the fill and stroke attributes填充和描边属性的颜色部分

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 文字修饰:双行; 无法在Chrome中使用 - text-decoration: line-through double; not working in chrome 文本修饰:直通无法在IE上运行? - Text-decoration: line-through not working on IE? 是否可以通过文本装饰为 CSS 行设置动画? - Is it possible to animate a CSS line-through text-decoration? 如何自定义颜色顺风css上的横穿文字装饰 - How to customize color The line-through text decoration on tailwind css 单击复选框时,是否可以从左到右的文本装饰为 CSS 线条设置动画? - Is it possible to animate a CSS line-through from left to right text-decoration when clicking a checkbox? 为“:before /:after”伪类重写“text-decoration:line-through” - Override “text-decoration: line-through” for “:before/:after” pseudo class 删除/隐藏网站上所有“文本装饰:直通”格式的元素? - Remove/Hide all “text-decoration: line-through” formatted elements on a Website? 如何在边框内的所有链接之间加线并用粗体标记段落的某些文本 - How to line-through all links inside a border and bold mark certain text of a paragraph 自动显示文字直通 - Display text line-through automatically 使用sIFR的删除线或直行文本 - Strikethrough or line-through text using sIFR
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM