I am currently working on creating a CSS style that will allow me to scale an image to fit a letterbox-shaped div perfectly. The excess overflow will be cropped off, but I am encountering some issues with alignment. The current display can be seen here:
https://i.sstatic.net/2iqd4.png
The original image can be viewed at this link:
https://i.sstatic.net/kjkPb.jpg
It is my goal to adjust the alignment so that the image is centered vertically within the div instead of being aligned to the top. What do I need to modify in order to achieve this effect? My current HTML and CSS code are as follows:
.crop {
width: 670px;
height: 200px;
overflow: hidden;
}
.crop img {
width: 670px;
}
<div class='crop'>
<img src='http://cycle.travel/images/600/amsterdam_ccby_conor_luddy.jpg' />
</div>
It is important to note that I cannot assume that the height of the image will remain consistent across all instances of its use.