To crop images, you can use the following method:
CSS:
.image-crop {
width: 200px;
height: 300px;
overflow: hidden;
}
.image-crop img {
margin-top: -100px;
margin-left: -200px;
}
Adjust the height
and width
of the container to customize the size of the cropped image. You can also modify the negative margin-top
and margin-left
on the image element itself to select the specific part of the image to crop.
HTML:
<div class="image-crop">
<img src="your-image.jpg"/>
</div>
View Demo
If you are looking for an alternative solution for a 2 column grid with fixed height rows, consider the following approach:
CSS:
body {
margin: 0;
}
div.image {
float: left;
width: 49%;
margin: 0.5%;
height: 100%;
background-size: cover!important;
background-repeat: no-repeat!important;
}
div.row {
height: 300px;
}
HTML:
<div class='row'>
<div class='image' style='background: url("image-one.jpg");'> </div>
<div class='image' style='background: url("image-two.jpg");'> </div>
</div>
<div class='row'>
<div class='image' style='background: url("image-three.jpg");'> </div>
<div class='image' style='background: url("image-four.jpg");'> </div>
</div>
View Demo