Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<head>
<style>
img.a {
  width: 200px;
  height: 400px;
  object-fit: cover;
}
</style>
</head>
<body>
<h2>The object-fit Property</h2>
<h2>object-fit: cover:</h2>
<p>Cut off the sides of an image, preserving the aspect ratio, and also filling in the space:</p>
<img class="a" src="paris.jpg" alt="Paris" width="400" height="300">
<h2>Original image:</h2>
<img src="paris.jpg" alt="Paris" width="400" height="300">
<p>Note: The object-fit property is not supported in Edge 15 or earlier.</p>
</body>
</html>