How do I use css pseudo classes?
-
Pseudo classes add a kind of an effect to an element, said to define a special state to an element.
This HTML of a link. Can be change when the pointer/cursor hovers over the link, when the link is clicked or when the link is active.
<a href="https://wikipedia.org" target="_blank">Go to Wikipedia!</a>
CSS code Here we have chosen pseudo class hover and visited for the HTML (anchor) link element.
... a:hover { color: red } a:visited { color: green } ...
The result is:
The screenshot is not shown here but when the mouse hovers over the link it turns red and after it is visited (clicked) it turns green.Also see: https://www.w3schools.com/css/css_pseudo_classes.asp for a list of pseudo classes.
© Lightnetics 2024