Hover and Focus States
Pseudo-classes let you style elements based on their state, like when hovered or focused.
The :hover Pseudo-class
Style elements when the mouse is over them:
Loading CSS Playground...
The :focus Pseudo-class
Style elements when they have keyboard focus:
Loading CSS Playground...
The :active Pseudo-class
Style elements while being clicked:
Loading CSS Playground...
Link States
Links have special pseudo-classes for their states:
Loading CSS Playground...
Card Hover Effects
Loading CSS Playground...
Focus-Visible
:focus-visible only shows focus styles for keyboard navigation:
Loading CSS Playground...
Exercise: Style Button States
Create hover and focus styles for a button:
Loading CSS Exercise...
Up next · Lesson 11 of 27
Structural Pseudo-Classes
2 min read
10 of 27 lessons done

Ask Byte about this lesson
A private chat about this lesson. Byte has read the whole lesson, answers in seconds, and shows the section each answer comes from. Ask follow-ups in any language.
Questions & Answers
Public questions about this lesson. The AI Tutor answers right away in your language, the FreeAcademy team checks answers, and every learner can read them.

