:hover :focus :active and :visited
Style interactive link and button states using the most common CSS pseudo-classes.
What are Pseudo-classes?
Pseudo-classes select elements based on their state or relationship to other elements. They start with a single colon : and do not require adding attributes to HTML.
:hover
:hover applies when the user's pointer is over an element. The most common interactive state selector.
a:hover {
color: royalblue;
text-decoration: underline;
}
.card:hover {
box-shadow: 0 8px 32px rgba(0,0,0,0.15);
transform: translateY(-2px);
}All lessons in this course
- :hover :focus :active and :visited
- :nth-child and :nth-of-type
- :not() :is() and :where()
- :checked :disabled and Form State Pseudos