05-12-2011, 01:35 PM | #1 |
Member
Posts: 19
Karma: 10
Join Date: Apr 2011
Device: iPad
|
Center a div
Is possible center a div without using text-align?
I have a page with one big image and a small text, like a caption, and I would center both, but the text still align left. In websites is commom use margin-left/right:auto and div align: center. But this look like doesn't work in epub. |
05-12-2011, 06:43 PM | #2 |
Connoisseur
Posts: 61
Karma: 12096
Join Date: Sep 2010
Location: Tasmania
Device: Sony PRS 650
|
Misunderstood. Reply removed.
Last edited by Faster; 05-14-2011 at 03:56 PM. |
Advert | |
|
05-13-2011, 04:32 AM | #3 | |
frumious Bandersnatch
Posts: 7,522
Karma: 19000001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
Code:
--------------------------- | XXXXX | | | | Fig1. caption | | text. | | | | Normal text paragraph | | with full justification | | etc. | --------------------------- Code:
<div class="illustration"> <img src="image.jpg" alt="" /> <p class="caption">Fig. 1: Caption text.</p> </div> div.illustration { text-align: center; /* this centers the image */ } p.caption { text-align: left; /* this keeps the caption left-aligned */ /* to center the caption block, use */ /* either these two lines: */ width: 60%; margin: 0 auto; /* or just this one: */ margin: 0 20%; } |
|
05-13-2011, 06:57 AM | #4 |
Member
Posts: 19
Karma: 10
Join Date: Apr 2011
Device: iPad
|
Thanks Jellby. I think it will help.
|
05-13-2011, 07:39 AM | #5 |
Member
Posts: 19
Karma: 10
Join Date: Apr 2011
Device: iPad
|
The second way (margin: 0 20%
works better in ADE and Calibre. |
Advert | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Mobipocket conversion: div bgcolor and border | kentmatt | Conversion | 3 | 01-23-2011 12:46 AM |
Can you delete div with align=center | mufc | Recipes | 4 | 12-10-2010 06:23 PM |
Questions about <p> and <div> and paragraph spacing | droople | Sigil | 7 | 08-14-2010 12:03 PM |
Remove spacing between paragraphs - what about div tags ? | NASCARaddicted | Calibre | 5 | 11-07-2009 05:47 AM |
Exclude <div>s from processing in HTML2LRF | MTBSJC | Calibre | 1 | 02-13-2009 03:26 AM |