How to use CSS object-fit to control your images

Kevin Powell on YouTubeWatch on YouTube

SaveMark complete

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

BeginnerUI6 min

About this video

A short tutorial explaining the CSS object-fit property and its values, including cover, contain, fill, scale-down and none, for controlling how images fill their containers. It is aimed at people building web pages who want to control image display.

What you’ll learn

  • Use object-fit to control how an image fills its container
  • Compare cover, contain, fill, scale-down and none
  • Predict how none differs from the default behaviour