View Single Post
Old 01-25-2015, 10:40 AM   #18
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,556
Karma: 19500001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by RS21 View Post
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.
Jellby is online now   Reply With Quote