CSS: Center Text Blocks using margin and fixed-width
Calling attention to a block of text
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 text blocks is to set the margins to ‘auto’ along with a fixed width. Without the fixed width, the block would simply fill the available width of the screen.
Here is an example:
CSS
p.blocktext {
margin-left: auto;
margin-right: auto;
width: 6em
}
HTML
<p class=”blocktext”> This is a very narrow block of text that is centered….
Modify the width to the exact measurement desired. You can also use a percentage value if desired.
Posted by admin | 0 comments

First Steps Publishing is committed to quality. ALL of our eBook files are tested against the QED (Quality, Excellence, Design) 13-steps checklist.