Quote:
Originally Posted by RS21
Code:
img#cover
{
max-width: 100%;
max-height: 100%;
display: block;
margin-left: auto;
margin-right: auto;
}
This will maintain aspect ratio,
|
No guarantee, as far as I know. An oversized image could be downscaled to 100% width
and 100% height, which does not preserve aspect ratio.
Quote:
and will horizontally center the image
|
only if the reader does not ignore auto margins, and it is allowed to.
The problem of that approach (and actually the same more or less applies to the standard SVG wrapper) is that there is no way to access screen height. "height: 100%" might give you a full height, or maybe not.