<div class="blaock"></div>


<img src="https://mdn.mozillademos.org/files/6457/mdn_logo_only_color.png" alt="MDN Logo" class="fill"/>


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


.blaock{
  background-image:url(https://mdn.mozillademos.org/files/6457/mdn_logo_only_color.png);
  width:100px;
  height:100px;
  background-size: cover;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.