The closest I can access is the following example:
http://jsfiddle.net/YRFJQ/1/
or
.container { background: blue; border: 10px solid blue; max-height: 200px; max-width: 200px; overflow:hidden; box-sizing:border-box; } img { display: block; max-height: 100%; max-width: 100%; }
The main problem is that the height takes a percentage of the height of the containers, so it looks for the explicitly set height in the parent container, not max-height.
The only way around this to some extent, I see, is the fiddle above, where you can hide the overflow, but then the fill still acts as the visible space for the image, and instead is replaced with a solid border (and then adding a border box to make it 200px if you need this width)
Not sure if this will fit what you need, but perhaps best.
ashleynolan Jan 10 '13 at 17:17 2013-01-10 17:17
source share