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 MUST come after a:link and a:visited a:active MUST come after a:hover"
I want to know why the correct order is L.V.H.A, not L.H.V.A or another.
Definition and Usage The :visited selector is used to select visited links. Tip: Use the :link selector to style links to unvisited pages, the :hover selector to style links when you mouse over them, and the :active selector to style links when you click on them.
When setting the style for several link states, there are some order rules: a:hover MUST come after a:link and a:visited. a:active MUST come after a:hover.
The :hover selector is used to select elements when you mouse over them.
Pseudo-classes must be declared in a specific order.
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.
That is to say:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With