CSS Architecture — exercises and bug fixes
5 hands-on exercises and 5 find-the-bug challenges for the CSS Architecture lesson. Every one is checked automatically in the browser — write the code, run it, and the tests tell you what still fails.
Exercises(5)
- 1
Centralise a token
easy10 minDefine --space as 16px on #wrap and pad with it.
- 2
Provide a fallback
easy10 minPad #wrap with --space, falling back to 12px when it is undefined.
- 3
Structure with layers
easy10 minA reset layer and a components layer; components should win.
- 4
Keep specificity flat
easy10 minStyle the .lead class rather than reaching for the id.
- 5
Compose tokens and layers
medium10 minTokens on the wrapper, components layer using them.
Find the bug(5)
- 1
Fix the hard-coded value
easy8 minThe padding should come from the token, not a repeated literal.
- 2
Fix the fallback separator
easy8 minA var() fallback follows a comma.
- 3
Fix the layer order
easy8 mincomponents must come after reset to win.
- 4
Fix the over-specific selector
easy8 minA long id chain is harder to override than a class.
- 5
Fix the token out of scope
easy8 minThe tokens must sit on an ancestor of the element using them.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspace