CSS basics: Class selectors
A class selector targets an intentional reusable hook rather than every element of a type.
Current edit
Understand the pattern
A class selector targets an intentional reusable hook rather than every element of a type.
A class selector targets an intentional reusable hook rather than every element of a type.
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
.notice { color: #164e45; }
.notice { padding: 1rem; }
.notice { border: 1px solid #658b84; }A class selector targets an intentional reusable hook rather than every element of a type.
Explain it
Apply it elsewhere
Keep the momentum.
Complete the lab, then explain and apply the pattern.
Next: CSS basics: Color tokensTry 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: Element selectorsAn element selector applies declarations to every matching element in its scope.Practice
- 02CSS basics: Color tokensCustom properties centralize reusable values; var() reads a token and can provide a fallback.Practice
- 03CSS basics: Readable typographyFont size, line height, and line length work together. Line height without a unit scales with the text.Practice