object-fit requires a width and height

The object-fit property requires a width and height to be set on the image.

The object-fit property won’t work correctly without a width and height property also assigned in the CSS rule, as well.

.fill {
object-fit: cover;
width: 100%;
height: 100%;
}

The width and height do not need to match the aspect ratio of the original image.

The container must also have a defined width and height.