Pseudo Classes
You may have noticed that sometimes the style of an element changes based on its state. Most commonly, an animation is triggered when the mouse hovers over an element. This can be achieved using pseudo classes, specifically the :hover
pseudo class.
A pseudo class can be combined with any selector. For example:
a:hover {
background-color: blue;
}
With this code, whenever we hover over an a
element (link), its background color will change to blue.
Instructions
For p
elements on hover, create a rule with the following declaration color: red;
.
Start programming for free
7/12