I have a div container with a fixed height. The image in the div can be lager than de height of the div. The width of the image is set to 100% of the div. I would like to the image to be vertically centered; now the top of the image is shown, which sometimes can create a strange looking crop.
The html is:
<div class="itemImageBlock" style="/* padding:0px; */"> <span> <a class="modal" rel="{handler: 'image'}" href="/media/k2/items/cache/23ac69ecf90d97d87602b5da326dea8e_XL.jpg" title="Klik om afbeelding te bekijken"> <figure> <img src="/media/k2/items/cache/23ac69ecf90d97d87602b5da326dea8e_L.jpg" alt="Bootleg Betty" style="width:100%; height:auto;"> </figure> </a> </span> </div> And the css is:
div.itemImageBlock { padding: 0px; margin: 0 0 16px 0; height: 450px; overflow: hidden; } I've tried to use display: table-cell; but then I loose the height and get a full image. (that is the overflow: hidden is lost)