A pseudo-class is used to define a special state of an element.
Syntax:-
selector:pseudo-class { property:value; }
Ex: –
div:hover { background-color: red;}
Pseudo-classes–
- :link
- :visited
- :hover
- :active
- :focus
- :checked
- :first-child
- :first-of-type
- :nth-child(n)
![](https://www.wideskills.com/sites/default/files/subjects/CSS%20Tutorial/22/Image_1.png)
![](https://ironion.com/wp-content/uploads/2015/06/cssanatomy3.png)