CSS object-fit Property Explained

What the CSS object-fit property does, with an example.

Published November 5, 2026

The CSS object-fit property controls how an image or video is resized to fit its container, similar to background-size.

Key points

  • Check browser compatibility on a resource like caniuse.com if targeting older browsers

Example

object-fit: cover;
More CSS articles