object-fit

object-fit: fill | contain | cover | none | scale-down;


  • fill - This is default. The image is resized to fill the given dimension. If necessary, the image will be stretched or squished to fit.
  • contain - The image keeps its aspect ratio, but is resized to fit within the given dimension.
  • cover - The image keeps its aspect ratio and fills the given dimension. The image will be clipped to fit.
  • none - The image is not resized.
  • scale-down - the image is scaled down to the smallest version of none or contain.