Skip to main content
Module 14 · Lesson 1 of 453/60 in the course~20 min
Module lessons (1/4)

Responsive <picture>, srcset, sizes & Art Direction

Lesson preview6 hands-on exercises readyModern HTML & CSS · Responsive Media, SVG, Visual Effects & Adaptive Modes

Switch cropped hero assets across breakpoints via <picture> media rules alongside aspect-ratio and object-fit without layout shift.

What you'll learn in this lesson

  • Distinguish resolution/DPI switching (srcset + sizes) from breakpoint crop Art Direction (<picture> + <source media>).
  • Prevent Cumulative Layout Shift (CLS) on responsive media using width/height hints, aspect-ratio, and object-fit: cover.
  • Keep every responsive <picture> and <figure> clean at narrow 375px mobile widths without horizontal overflow.

Overview

Most responsive images only need the same subject at different pixel widths—where browser resolution selection via <img srcset="..." sizes="..."> shines. Switch to <picture> whenever the crop, orientation, or file format itself changes by viewport width (for example, serving a tight vertical 4:5 portrait on mobile and a wide 16:9…

Sections covered in this lesson

  1. 1When srcset Is Enough vs <picture> Art Direction
Pro Lesson · Responsive Media, SVG, Visual Effects & Adaptive Modes

Unlock "Responsive <picture>, srcset, sizes & Art Direction" and the full Modern HTML & CSS curriculum

Switch cropped hero assets across breakpoints via <picture> media rules alongside aspect-ratio and object-fit without layout shift.

Unlock all 6 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.