CSS text-shadow 属性不遵循 :visited 伪类的层次结构

发布于 2025-01-06 05:10:14 字数 669 浏览 4 评论 0原文

我对CSS中的visited伪类和text-shadow属性有一个小问题。

这是我的代码:

li.episode a{
display: block;
float: left;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
margin: 1px;
padding: 5px;
font-size: 14px;
background-color: #eeeaea;
text-shadow: 0 1px 0 white;
}

li.episode a:visited {
background-color: #23EE44;
text-shadow: none;
color: white;
}

li.episode a:hover {
background-color: #23EE44;
text-shadow: 0 1px 0 #10C72E;
color: white;
}

事实上,我想要的是访问的链接与悬停时一样。

:悬停在 Chrome/Safari 上工作正常,但访问的链接保留第一个文本阴影属性:

    text-shadow: 0 1px 0 white;

而不是下面给出的属性(我尝试在代码中使用“none”,但似乎不起作用..)

谢谢大家你的帮助!

I have a little problem with the visited pseudo-class and the text-shadow property in CSS.

Here is my code:

li.episode a{
display: block;
float: left;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
margin: 1px;
padding: 5px;
font-size: 14px;
background-color: #eeeaea;
text-shadow: 0 1px 0 white;
}

li.episode a:visited {
background-color: #23EE44;
text-shadow: none;
color: white;
}

li.episode a:hover {
background-color: #23EE44;
text-shadow: 0 1px 0 #10C72E;
color: white;
}

In fact what I would like to have is the visited link just the same as when hovered.

:Hover works fine on Chrome/Safari but the visited link keeps the first text-shadow property:

    text-shadow: 0 1px 0 white;

Instead of the one given below (I tried to use "none" in my code but doesn't seem to work..)

Thanks guys for your help !

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

℉絮湮 2025-01-13 05:10:14

由于

MDN 将可修改的属性定义为(这些可能因浏览器而异,但 text-shadow 肯定不适用于任何浏览器,至少不能修改它的大小):

  • 颜色
  • 背景颜色
  • 边框颜色
  • 轮廓颜色

以及此外,如果基本 a 选择器完成了其中一项操作,您将无法定义不透明度或显示/隐藏链接。

There are a very few css properties you can explicitly define for :visited due to security issues.

MDN defines the modifyable properties as (these may vary by browser, but text-shadow is certainly one that shouldn't work on any browser, at least modifying the size of it):

  • color
  • background-color
  • border-color
  • outline-color

And in addition you won't be able to define opacity or show/hide the links if the base a selector has done one of those things.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文