链接顺序在css [英] link order in css
问题描述
< a>
元素(链接,已访问,悬停,活动)的样式的正确顺序如何。
Whats the correct order of styling the <a>
element (link, visited, hover, active). All are confusing by providing different combination like LVHA, LAHV. Can anybody specify the correct ordering?
推荐答案
>链接已访问的悬停活动
Link Visited Hover Active
引用 CSS规格:
a:link { color: red } /* unvisited links */
a:visited { color: blue } /* visited links */
a:hover { color: yellow } /* user hovers */
a:active { color: lime } /* active links */
请注意,A:hover必须放在A:link和A:visited规则,因为否则级联规则将隐藏A:hover规则的'color'属性。类似地,因为A:active放置在A:hover之后,当用户激活并悬停在A元素上时,将应用活动颜色(lime)。
Note that the A:hover must be placed after the A:link and A:visited rules, since otherwise the cascading rules will hide the 'color' property of the A:hover rule. Similarly, because A:active is placed after A:hover, the active color (lime) will apply when the user both activates and hovers over the A element.
这篇关于链接顺序在css的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!