The object-fit property specifies how the contents of a replaced element should be fitted to the box established by its used height and width.
object.style.objectFit = "value";
<'object-fit'> = fill | contain | cover | none | scale-down
The replaced content is sized to fill the element's content box.
The replaced content is sized to maintain its aspect ratio while fitting within the element's content box.
The replaced content is sized to maintain its aspect ratio while filling the element's entire content box.
The replaced content is not resized to fit inside the element's content box.
Sizes the content as if none or cover were specified, whichever would result in a smaller concrete object size.
World Wide Web Consortium (W3C)