[英]Combining multiple pseudo-selectors
It appears that at one point in time combining multiple pseudo-selectors was possible. 似乎在某个时间点可以组合多个伪选择器。 For example, one could do this:
例如,可以这样做:
a:visited:hover {color: red}
A quick Google search reveals multiple examples of this in action, here , here , and here . 通过Google的快速搜索,您可以在此处 , 此处和此处看到有关此操作的多个示例。 I am unable to get this feature to work in the latest versions of Safari, Firefox, or Chrome.
我无法使用此功能在Safari,Firefox或Chrome的最新版本中使用。 Can anyone explain why this feature has regressed and/or been handicapped?
谁能解释为什么此功能被退回和/或残障?
The :visited
pseudoclass can't be used for most styling in a lot of modern browsers anymore because it's a security hole. :visited
伪类已不能再用于许多现代浏览器的大多数样式中,因为这是一个安全漏洞。 See this link for a more formal discussion on it. 请参阅此链接 ,以进行更正式的讨论。
The short version is that if you can style :visited
links differently, you can use that to determine if people have visited various sites, and therefore target them based on their browser history. 简短的版本是,如果您可以对
:visited
链接进行不同的样式设置,则可以使用它来确定人们是否访问了各个站点,并因此根据他们的浏览器历史来定位他们。 Most modern browsers therefore heavily restrict the styling that can be done on them. 因此,大多数现代浏览器都严重限制了可以在其上进行的样式设置。
You can still chain pseudoselectors. 您仍然可以链接伪选择器。 For example,
a:focus:hover
works just fine to apply styles only if the element is focused AND hovered. 例如,
a:focus:hover
仅在元素被聚焦并a:focus:hover
才能很好地应用样式。 See this link for a demonstration. 请参阅此链接进行演示。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.