srcset and sizes attributes - [ images on the web | part one ]

Kevin Powell on YouTubeWatch on YouTube

SaveMark complete

Sign in to save videos and track what you’ve finished.

IntermediateUI30 min

About this video

A tutorial on using the srcset and sizes attributes in HTML to serve different image versions based on viewport width or pixel density. It covers how sizes relies on media queries in the markup and how this reduces bandwidth while keeping images sharp on high-density screens.

What you’ll learn

  • Use srcset to offer multiple image versions by viewport width or pixel density
  • Write sizes attributes that match layout breakpoints for responsive images
  • Weigh the markup cost of responsive images against the bandwidth savings