Skip to content
Clairos Learn

CSS basics · Lesson 9 of 12 · 7 minutes

CSS basics: Reusable utility classes

Small utility classes should have a predictable job and avoid accidental changes to unrelated components.

Mastery 0/3Run itExplain itApply it
Web workshopInert preview · code inspection

Current edit

PreviewNo external resources

Understand the pattern

Small utility classes should have a predictable job and avoid accidental changes to unrelated components.

Small utility classes should have a predictable job and avoid accidental changes to unrelated components.

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
.stack { display: flex; }
.stack { flex-direction: column; }
.stack { gap: 1rem; }

Small utility classes should have a predictable job and avoid accidental changes to unrelated components.

Try a variation

Adapt the final example to a different project name while retaining its structure and relationships. A different context still needs a real browser and accessibility check.

Explain it

Which statement correctly explains reusable utility classes?

Apply it elsewhere

You reuse reusable utility classes in a different project. What must still be verified?

Keep the momentum.

Complete the lab, then explain and apply the pattern.

Next: CSS basics: Hover statesTry an incident drill

Anonymous 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

  1. 01CSS basics: Background surfacesA background should keep foreground content readable rather than carry meaning alone.Practice
  2. 02CSS basics: Hover statesHover is one interaction state, not the only indication that a control can be used.Practice
  3. 03CSS basics: Focus-visible statesKeyboard focus needs a visible indicator. focus-visible can provide one without relying on hover.Practice