Thread: margin: 0 auto;
View Single Post
Old 07-16-2010, 04:06 PM   #15
troymc
Groupie
troymc will become famous soon enoughtroymc will become famous soon enoughtroymc will become famous soon enoughtroymc will become famous soon enoughtroymc will become famous soon enoughtroymc will become famous soon enough
 
Posts: 161
Karma: 608
Join Date: Aug 2008
Location: Plano, TX
Device: Sony PRS-505 + B&N Nook + Motion LE1700 + Motorola Xoom Wifi
Quote:
Originally Posted by EricDP View Post
My workaround is to create a centered block, and then inside that create an inline-block that is left aligned.

Problem: inline-blocks can't wrap pages (because they are treated as a single element).
Solution: create a separate block for each verse - hopefully your verses aren't too long.

New Problem: Using the above solution, each verse will now be centered relative to its own line lengths, not relative to the entire poem.
Solution: create a custom negative margin for each verse (except the widest, of course) to align the left edges of all the verses. If you specify this margin in "em" instead of "%" it will stay fairly close to aligned at different font sizes/different screen widths.

It's not perfect, but it's the best I can come up with given the current limitations.

If you want some sample code, I can post it later when I get home.
I would definitely like to see a sample of that.

Have you tried that on any ADE based ereader? I didn't think inline-block was supported in epubs. And how did you center the outside block without auto margins?


Troy
troymc is offline   Reply With Quote