Site icon Nandie

How to fix image in div without stretching in CSS if the image size is greater than or less than div

Spread the love

 

How to fix an image in div without stretching in CSS if the image size is greater than or less than div 

object-fit property is used for images or video for set in div without stretch it

.image{


height:100%;
width:100%;
object-fit:cover;

}

Here arrives the object-fit property.  It has one of the following rules:

Exit mobile version