I have designed a 'grid view' to display items on my site. However, because it's completely responsive, the images cannot be a fixed width. This is what I'm trying to achieve.
- The image must not stretch past it's original dimensions
- The image may not change proportions
- The image should be vertically and horizontally centered in the box that is clipping (overflow:hidden) it.
More or less, I'm trying to make the image, fill the container but only if it can without changing proportions or stretching, obviously it would have to check against the height and width of the image and it's original size but I don't know how to do this, can anyone help with this?
A simple version of the current grid item I have in the fiddle provided would be as follows:
<div class="container">
<div class="item"><div class="overflow"><img src="/bla.jpg" /></div></div>
</div>
Where the overflow would have a fixed height and width, only changing depending on screen size, and would 'clip' the image.
Shannon