css · level 3 check
a themeable component set.
Time to ship. You are finishing the component set for Fern, a plant shop: a button, a badge and three cards, one with a photo, one without, and one inside a dark theme. Every colour and space comes from tokens, and the dark theme must work by swapping tokens alone.
Fill in each `____`. Rank the layers so `utilities` comes last, point `--action-bg` at the `--green-700` primitive, give `.theme-dark` the `--ink-900` surface, and give the badge `--green-200` as a fallback in case a page never sets `--badge-bg`.
Then mark cards with no image using `:not()` and `:has()`, draw the focus ring from the `--focus` token, and switch the button's animation off for visitors who asked for reduced motion. Run it after each blank.
the page you’re styling
<main class="shop">
<button class="btn">Add to basket</button>
<span class="badge">New</span>
<div class="card">
<img src="tree.svg" alt="An olive tree">
<h3 class="title u-flush">Olive tree</h3>
</div>
<div class="card">
<h3 class="title">Seed kit</h3>
</div>
<section class="theme-dark">
<div class="card">
<h3 class="title">Night orchid</h3>
</div>
</section>
</main>Fill in every ____ then run the checks.
Run the checks to see your page here.
- 1 The button is built from tokensuses: custom properties
- 2 The dark theme swaps tokens, not rulesuses: themes
- 3 Utilities win because of the layer orderuses: cascade layers
- 4 Cards without a photo still look finisheduses: :has()
- 5 The badge survives a missing tokenuses: fallbacks
- 6 Keyboard and motion settings are respecteduses: accessibility
Take as long as you like and try as many times as you want.
css · level 3 · expert
level up.
You passed every check and finished every level. You have the full set of faces.
- 28 lessons in this level
- 6 of 6 checks passed
This pass isn’t saved. A free account keeps your new face.