object-fit: contain; set the img image without deformation

The object-fit attribute specifies how the content of an element should fit within the height and width of the specified container.

object-fit is generally used for img and video tags, and generally these elements can be cut, scaled or directly stretched to retain the original ratio.

 You can toggle the alignment of the replaced element's content object within the element's box by using  the object-position property.

Guess you like

Origin blog.csdn.net/qq_37548296/article/details/130351421