Quote:
Originally Posted by marcelo2605
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.
|
What do you mean the text is "centered, but still aligned left"? I'm guessing you want a left-aligned text block, but that does not take the full page width, having equal right and left margins. something like this:
Code:
---------------------------
| XXXXX |
| |
| Fig1. caption |
| text. |
| |
| Normal text paragraph |
| with full justification |
| etc. |
---------------------------
In that case, you have to either set an explicit width for the text block and "auto" margins (which do not work in some readers), or set the margins explicitly, i.e.:
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%;
}