CSS: Center Text Blocks using margin and fixed-width
At times, in both nonfiction and fiction ebook formatting, you may want to set off an area of text from the rest of the content. The easiest way to center…
At times, in both nonfiction and fiction ebook formatting, you may want to set off an area of text from the rest of the content. The easiest way to center…
Centering images can add a special design appeal to your ebook formatting. This can be applied book-wide (to all images) or applied individually. The easiest way to center images is to make the image a block of its own and set the margins to ‘auto’.
Here is an example:
CSS
img.individual { display: block; margin-left: auto; margin-right: auto; }
HTML
<IMG class="individual" src="..." alt="...">
CSS level 2 does not have a property for centering things vertically. There will probably be one in CSS level 3. However, you can center block vertically in CSS2 by…