View Single Post
Old 09-16-2012, 01:19 PM   #1
mjwilson
Connoisseur
mjwilson ought to be getting tired of karma fortunes by now.mjwilson ought to be getting tired of karma fortunes by now.mjwilson ought to be getting tired of karma fortunes by now.mjwilson ought to be getting tired of karma fortunes by now.mjwilson ought to be getting tired of karma fortunes by now.mjwilson ought to be getting tired of karma fortunes by now.mjwilson ought to be getting tired of karma fortunes by now.mjwilson ought to be getting tired of karma fortunes by now.mjwilson ought to be getting tired of karma fortunes by now.mjwilson ought to be getting tired of karma fortunes by now.mjwilson ought to be getting tired of karma fortunes by now.
 
Posts: 96
Karma: 511127
Join Date: May 2012
Device: Kindle Keyboard
kindlegen - center image using CSS only?

Wondering if kindlegen can center an image, using CSS only (no <center> in the HTML), for both Mobi and KF8 formats.

What I'm trying to do is create a single HTML page working for desktop and mobile browsers, and, via kindlegen, for Mobi and KF8, without any hacks. I have images which will be floated-right on larger displays, and centered on smaller ones, so I want to do the positioning in CSS only, and target different devices using Media Queries.

For the centered image I have

display: block; margin-left: auto; margin-right: auto;

which is the normal way to do it, I believe.

In the Kindle previewer (which I assume will work the same as kindlegen), this works fine for Kindle Fire/Kindle Touch devices, but for the standard Kindle it doesn't work, the image is just on the left margin.

Any ideas?
mjwilson is offline   Reply With Quote