How can i fit images in to div ( Ionic )


I have a div container and inside of div i have a img.

  <div  style="background-color: red; height: 200px; width: 200px;">
    <ion-img  src="{{kategori[i].img}}"></ion-img>


I want to fill that div with my image. But its not fit inside. Its looks like that :

Some of them being small some of them being big. How can i fill inside of div ? I dont want see red background and i want it fill inside of div. Its my css code :

ion-img {

  border-radius: 15px;
  background-size: cover;
  max-width: 100% !important;
  max-height: 100% !important;

Thanks for help


ion-img {
  border-radius: 15px;
  object-fit: cover;

Answered By – Kinglish

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published