为什么"a:hover必须跟随a:link和a:visited(w3school)"? [英] why “a:hover MUST come after a:link and a:visited(w3school)”?
问题描述
我正在"w3schools"的链接"一章中学习CSS,他们说:
I‘m study CSS in the "w3schools", in the chapter of "link", they say:
为几种链接状态设置样式时,有一些顺序规则:
"When setting the style for several link states, there are some order rules:
a:hover必须在a:link和a:visit之后 a:活动必须在a:悬停之后进行"
a:hover MUST come after a:link and a:visited a:active MUST come after a:hover"
我想知道为什么正确的订单是L.V.H.A,而不是L.H.V.A或其他.
I want to know why the correct order is L.V.H.A, not L.H.V.A or another.
推荐答案
伪类必须以特定顺序声明.
Pseudo-classes must be declared in a specific order.
助记符 L o V e HA te对于记住正确的顺序始终很有用:
The mnemonic LoVe HAte is always useful for remembering the correct order:
:link
:visited
:hover
:active
每个伪类都对应于一个事件,该事件只能在时间轴上比以前的事件发生得晚.
Each pseudo-class corresponds to an event which can only happen later in the timeline than the one before.
也就是说:
-
在访问链接之前,不会访问该链接.
A link is unvisited before it is visited.
在链接悬停之前已访问链接.
A link is visited before it is hovered over.
在链接处于活跃使用状态之前,请将其悬停.
A link is hovered over before it is in active use.
这篇关于为什么"a:hover必须跟随a:link和a:visited(w3school)"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!