Module 9 · Lesson 3 of 435/60 in the course~20 min
Module lessons (3/4)
Mobile-First @media, object-fit, aspect-ratio & picture
Lesson preview5 hands-on exercises readyModern HTML & CSS · Positioning, Stacking Context & Container Queries
Write progressive min-width breakpoints and crop responsive photography neatly via aspect-ratio and object-fit.
What you'll learn in this lesson
- Author clean mobile-first stylesheets using progressive
@media (min-width: ...)enhancements instead of tangledmax-widthoverrides. - Prevent stretched or squished responsive photos using
aspect-ratioandobject-fit: cover. - Deliver bandwidth-optimized artwork across viewport sizes cleanly using HTML
srcset,sizes, and<picture>.
Overview
Most beginners make responsive CSS twice as hard by designing desktop columns first, then spending hours writing max-width overrides to undo grids and margins back into single columns on phones!
Sections covered in this lesson
- 1Mobile-First Means Simple Base Styles First
- 2Cropping Responsive Images Cleanly (
aspect-ratio+object-fit)
Pro Lesson · Positioning, Stacking Context & Container Queries
Unlock "Mobile-First @media, object-fit, aspect-ratio & picture" and the full Modern HTML & CSS curriculum
Write progressive min-width breakpoints and crop responsive photography neatly via aspect-ratio and object-fit.
Unlock all 5 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.
- Instant access to all advanced modules in Modern HTML & CSS plus 17 more courses
- Hands-on browser exercises with automated test suites and solutions
- 14-day money-back guarantee processed via Paddle.com
14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.