A structured lesson workspace with readable content, hands-on examples, and a clean path to completion.
<style>section { display: block; }</style><main class="demo"><section>Example content</section></main>
The useful mental model here is practical: how formatting contexts decide line participation, width behavior, and vertical layout. 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 | Block, Inline, and Inline-Block Elements | Width and height do not behave like you expect on normal inline boxes. If you need a box to participate in a line while accepting dimensions, inline-block or a flex/grid parent is usually the clearer choice. |
| 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 |
In production, Width and height do not behave like you expect on normal inline boxes. If you need a box to participate in a line while accepting dimensions, inline-block or a flex/grid parent is usually the clearer choice. That is the kind of bug that survives visual spot checks because the stylesheet is syntactically valid while the layout contract is wrong.
The useful mental model here is practical: how formatting contexts decide line participation, width behavior, and vertical layout. When a rule looks obvious but the browser produces something else, start by identifying which constraint or rendering phase is actually winning.
<style>span { display: inline; }</style><main class="demo"><span>Example content</span></main>
Engineering judgment: Modern layout work often reaches for flex or grid rather than relying on inline-block spacing hacks, especially when the relationship between children needs explicit control.
<style>.badge { display: inline-block; padding: .2rem .5rem; }</style><main class="badge">Example content</main>
Inline-block badge is useful here because it demonstrates block, inline, and inline-block elements under a concrete input rather than as an abstract property list.
<style>.inline { display: inline; width: 20rem; }</style><main class="inline">Example content</main>
Width limitation is useful here because it demonstrates block, inline, and inline-block elements 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.