Formatting Tips: Print Style Paragraphs

About Formatting Tips.

When creating an ebook using EPUB paragraphs default to looking like they do on a web page. Each paragraph is separated by a blank line and there is tab indent. It’s relatively easy to format your ebook to look like a printed book. The first paragraph of a chapter should not have an indent but all subsequent ones should. Also, there should be no blank space between paragraphs. Paragraphs are broken up visually using the indent.

All of the paragraph formatting can be achieved using CSS. The first thing we want to worry about is the indent.

p {
    text-indent: 15px;

The above css sets the text indent for all p tags to 15 pixels. The first line of every paragraph will have an indent with that property set.

Next we want to remove the spacing between the paragraphs. Add the following to the p style block:

    margin-top: 0px;
    margin-bottom: 0px;

Now we need to worry about the first paragraph in every chapter. What we need to do is create a class that is applied to p tags and set it to leave the indentation alone on these paragraphs. The CSS block will look like this. {
    text-indent: 0px;

Any p tags in the XHTML with the “ni” class set will have the indentation removed. You will need to change the opening p tag of the first paragraph of each chapter to the following:

<p class="ni">

The best way to illustrate this concept is with an example. Download ft-print-style-paragraphs.epub. Opening the file with Sigil you will see the example chapters and the external CSS that is referenced by each XHTML file.