CSS basics: Hover states
Hover is one interaction state, not the only indication that a control can be used.
Current edit
Understand the pattern
Hover is one interaction state, not the only indication that a control can be used.
Hover is one interaction state, not the only indication that a control can be used.
Misconceptions to reject
- If the page fits one desktop viewport, no narrower viewport needs checking.
- Hiding all overflow always makes content accessible.
The preview is a sanitized subset, not a full browser compatibility test.
Worked example and expected result
button { background-color: #164e45; color: #ffffff; }
button:hover { background-color: #103b35; }
button { cursor: pointer; }Hover is one interaction state, not the only indication that a control can be used.
Explain it
Apply it elsewhere
Keep the momentum.
Complete the lab, then explain and apply the pattern.
Next: CSS basics: Focus-visible statesTry an incident drillAnonymous lesson and mastery progress lasts for this session. Sign in to keep synced lesson XP between sessions; mastery stays device-local. No speed bonus, lost lives, or hint penalties.
Keep learning
- 01CSS basics: Reusable utility classesSmall utility classes should have a predictable job and avoid accidental changes to unrelated components.Practice
- 02CSS basics: Focus-visible statesKeyboard focus needs a visible indicator. focus-visible can provide one without relying on hover.Practice
- 03CSS basics: Cascade reviewWith equal origin, importance, layer, and specificity, a later declaration wins for the same property.Practice