|
|
#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. |
|
|
|
|
|
#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 04:56 PM. |
|
|
|
| Advert | |
|
|
|
|
#3 | |
|
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,571
Karma: 20150435
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%;
}
|
|
|
|
|
|
|
#4 |
|
Member
![]() Posts: 19
Karma: 10
Join Date: Apr 2011
Device: iPad
|
Thanks Jellby. I think it will help.
|
|
|
|
|
|
#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 | |
|
|
![]() |
| Thread Tools | Search this Thread |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Mobipocket conversion: div bgcolor and border | kentmatt | Conversion | 3 | 01-23-2011 01:46 AM |
| Can you delete div with align=center | mufc | Recipes | 4 | 12-10-2010 07:23 PM |
| Questions about <p> and <div> and paragraph spacing | droople | Sigil | 7 | 08-14-2010 01:03 PM |
| Remove spacing between paragraphs - what about div tags ? | NASCARaddicted | Calibre | 5 | 11-07-2009 06:47 AM |
| Exclude <div>s from processing in HTML2LRF | MTBSJC | Calibre | 1 | 02-13-2009 04:26 AM |