A structured lesson workspace with readable content, hands-on examples, and a clean path to completion.
<style>.alert { color: #7f1d1d; }</style><main class="alert">Example content</main>
The useful mental model here is practical: how CSS color values, backgrounds, alpha channels, gradients, and layering interact. When a rule looks obvious but the browser produces something else, start by identifying which constraint or rendering phase is actually winning.
<style>.surface { background: rgb(255 255 255 / 0.86); }</style><main class="surface">Example content</main>
Engineering judgment: Prefer color functions that keep foreground and background relationships obvious. Gradients are paint instructions, not extra layout boxes.
The useful mental model here is practical: how CSS color values, backgrounds, alpha channels, gradients, and layering interact. When a rule looks obvious but the browser produces something else, start by identifying which constraint or rendering phase is actually winning.
| Concern | What to inspect | Typical failure |
|---|---|---|
| Core behavior | Colors, Backgrounds, and Transparency | Opacity on an element affects the entire rendered subtree. An alpha color on the background can create translucent paint without making the text translucent. |
| Production test | Real content and constraints | The rule works only for the demo values |
| Maintenance | Scope and override path | A later fix creates another exception |
A good CSS change narrows the problem. Prefer color functions that keep foreground and background relationships obvious. Gradients are paint instructions, not extra layout boxes. This keeps the rule understandable when content, theme, or viewport conditions change later.
<style>.hero { background: linear-gradient(135deg, #0f172a, #1e3a8a); }</style><main class="hero">Example content</main>
Linear gradient is useful here because it demonstrates colors, backgrounds, and transparency under a concrete input rather than as an abstract property list.
<style>.ghost { border: 1px solid rgb(15 23 42 / 0.14); }</style><main class="ghost">Example content</main>
Transparent border is useful here because it demonstrates colors, backgrounds, and transparency under a concrete input rather than as an abstract property list.
Finish the lesson once you have worked through the material. This awards ★ 20 XP.