A structured lesson workspace with readable content, hands-on examples, and a clean path to completion.
| Concern | What to inspect | Typical failure |
|---|---|---|
| Core behavior | Aspect Ratio and Object Fitting | aspect-ratio does not crop an image by itself. It gives the box a ratio; object-fit determines how replaced content fills that box. |
| 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, aspect-ratio does not crop an image by itself. It gives the box a ratio; object-fit determines how replaced content fills that box. That is the kind of bug that survives visual spot checks because the stylesheet is syntactically valid while the layout contract is wrong.
A good CSS change narrows the problem. Separate box geometry from media fitting. This keeps the rule understandable when content, theme, or viewport conditions change later.
<style>.demo { aspect-ratio:16/9; }</style><main class="demo">Example content</main>
In production, aspect-ratio does not crop an image by itself. It gives the box a ratio; object-fit determines how replaced content fills that box. That is the kind of bug that survives visual spot checks because the stylesheet is syntactically valid while the layout contract is wrong.
<style>img{width:100%;height:100%;object-fit:cover;}</style><main class="demo"><div aria-label="Example media" class="media-placeholder" role="img">Media example</div></main>
Engineering judgment: Separate box geometry from media fitting.
<style>video{aspect-ratio:1;}</style><main class="demo">Example content</main>
Example 3 is useful here because it demonstrates aspect ratio and object fitting under a concrete input rather than as an abstract property list.
<style>.demo { object-position:center top; }</style><main class="demo">Example content</main>
Example 4 is useful here because it demonstrates aspect ratio and object fitting under a concrete input rather than as an abstract property list.
Finish the lesson once you have worked through the material. This awards ★ 30 XP.