Technique in practice (works great):
http://coding.smashingmagazine.com/2013/08/09/absolute-horizontal-vertical-centering-css
(first example in the article)
Results vary:
Chrome / Safari "scales" 100% of the width / height of the image using this technique from the vertical center within the "mask" with a fixed height of 300 pixels and a width of 100%. Therefore, when you increase the width of a container element, the image is cropped the same above and below when it is scaled, but the left and right edges “stick” to the container (without horizontal cropping).
.container
{
overflow: hidden;
position: relative;
width: 100%;
min-height: 310px;
min-width: 462px;
}
img
{
position: absolute;
top: 0; right: 0; bottom: 0; left: 0;
display: block;
width: 100%;
min-height: 310px;
margin: auto;
}
Here's the Fiddle (sorry for the inline code) to check:
http://jsfiddle.net/KgJbR/
Firefox , "" , , . , ?
Firefox , Safari - . , .
