Discuss CSS Object Fit and Position?

The object-fit CSS property sets how the content of a replaced element, such as an <img> or <video>, should be resized to fit its container.

You can alter the alignment of the replaced element’s content object within the element’s box using the object-position property. The object-fit property is specified as a single keyword chosen from the list of values below.

contain:

The replaced content is scaled to maintain its aspect ratio while fitting within the element’s content box. The entire object is made to fill the box while preserving its aspect ratio, so the object will be “letterboxed” if its aspect ratio does not match the aspect ratio of the box.

cover:

The replaced content is sized to maintain its aspect ratio while filling the element’s entire content box. If the object’s aspect ratio does not match the aspect ratio of its box, then the object will be clipped to fit.

fill:

The replaced content is sized to fill the element’s content box. The entire object will completely fill the box. If the object’s aspect ratio does not match the aspect ratio of its box, then the object will be stretched to fit.

none:

The replaced content is not resized.

scale-down:

The content is sized as if none or contain were specified, whichever would result in smaller concrete object size.

The object-position CSS property specifies the alignment of the selected replaced element’s contents within the element’s box. Areas of the box which aren’t covered by the replaced element’s object will show the element’s background. You can adjust how the replaced element’s object’s intrinsic size (that is, its natural size) is adjusted to fit within the element’s box using the object-fit property.