颜色被覆盖,但 css 中的文本装饰
colour is override and yet text decoration in css
我正在尝试 css 中锚标记的伪代码,即 link、已访问、悬停和活动。 html 是:
<a href="https://www.w3schools.com/html/" target="_blank">
w3school
</a>
而 css 是:
a:link {
color: blue;
text-decoration: overline underline;
}
a:visited {
color: green;
text-decoration: line-through;
}
a:hover {
color: red;
text-decoration: underline;
}
a:active {
color: black;
text-decoration: overline;
}
访问后,文字颜色为绿色,正确。但是,文字修饰是上划线和下划线,不是划线:visited is partially working。看起来颜色是层叠的,文字装饰不是。
有人可以解释一下吗?
如今的浏览器限制了您可以为 :visited
状态应用的样式 - 因为否则,通过 JavaScript 检查布局中的某些更改可以确定您是否访问了外部 URL 已经。
https://developer.mozilla.org/en-US/docs/Web/CSS/:visited#Styling_restrictions:
Styling restrictions
For privacy reasons, browsers strictly limit which styles you can apply using this pseudo-class, and how they can be used:
Allowable CSS properties are color, background-color, border-color, border-bottom-color, border-left-color, border-right-color, border-top-color, column-rule-color, and outline-color.
https://developer.mozilla.org/en-US/docs/Web/CSS/Privacy_and_the_:visited_selector:
Before about 2010, the CSS :visited selector allowed websites to uncover a user's browsing history and figure out what sites the user had visited. This was done through window.getComputedStyle and other techniques. This process was quick to execute, and made it possible not only to determine where the user had been on the web, but could also be used to guess a lot of information about the user's identity.
我正在尝试 css 中锚标记的伪代码,即 link、已访问、悬停和活动。 html 是:
<a href="https://www.w3schools.com/html/" target="_blank">
w3school
</a>
而 css 是:
a:link {
color: blue;
text-decoration: overline underline;
}
a:visited {
color: green;
text-decoration: line-through;
}
a:hover {
color: red;
text-decoration: underline;
}
a:active {
color: black;
text-decoration: overline;
}
访问后,文字颜色为绿色,正确。但是,文字修饰是上划线和下划线,不是划线:visited is partially working。看起来颜色是层叠的,文字装饰不是。 有人可以解释一下吗?
如今的浏览器限制了您可以为 :visited
状态应用的样式 - 因为否则,通过 JavaScript 检查布局中的某些更改可以确定您是否访问了外部 URL 已经。
https://developer.mozilla.org/en-US/docs/Web/CSS/:visited#Styling_restrictions:
Styling restrictions For privacy reasons, browsers strictly limit which styles you can apply using this pseudo-class, and how they can be used:
Allowable CSS properties are color, background-color, border-color, border-bottom-color, border-left-color, border-right-color, border-top-color, column-rule-color, and outline-color.
https://developer.mozilla.org/en-US/docs/Web/CSS/Privacy_and_the_:visited_selector:
Before about 2010, the CSS :visited selector allowed websites to uncover a user's browsing history and figure out what sites the user had visited. This was done through window.getComputedStyle and other techniques. This process was quick to execute, and made it possible not only to determine where the user had been on the web, but could also be used to guess a lot of information about the user's identity.