Styles for ePub Export

When you export an InDesign document for ePub, all of the styles for the publication are translated to style definitions in a CSS file. This includes character, paragraph, object, table, and cell styles. (Of course you can tell InDesign not to create the CSS file if you have created your own, but we will assume that you will let InDesign do the work for you.)

How you set up your styles can make or break the degree to which the result of the export is successful in duplicating the look and feel of the original document.

Setting up styles is a big thing, and it does take time. But there are shortcuts you can take to ease the workload. Once you have set up the styles for a document, save the setup as a template. The next time you have a similar project, instead of starting from scratch, start with the template or import its styles as a stylesheet.

The following discussion will create a project to explore some ways the whole process of setting up styles can be made simpler and more reusable. 

The document for the project will be created originally for print and later exported for ePub. The styles to be created will be for the spread shown below. 

Figure 1: The spread to be created.

New Document

The screen capture below shows the settings used for the new document dialog. Notice that extra steps were taken to save the settings as a Document Preset. This is important as you may find many occasions where you can use this preset in future projects.

Figure 2: New Document settings


The only color besides black that will be used in our document will be one we call Green. It will have the values c=90 M=20 Y=50 K=0. Access the Swatches panel from the Window menu (Window > Colors > Swatches).

Character Styles

For the most part in setting up character styles, the only attributes needing to be established are those that override the paragraph style. For instance, a style named Bold should only designate the Font Style (Bold). This way, the style can override any paragraph style that has a Bold family member. For completeness, you may want to add styles for ItalicBoldItalic, and Color (Green). Access the Character Styles panel from within the Window menu (Window > Styles > Character Styles)

Paragraph Styles

Access the Paragraph Styles panel from the Window menu (Window > Styles > Paragraph Styles). 
The first style to be created will be used for body copy. We will name it Body and give it the following settings:

  • Font: Myriad Pro Regular
  • Size: 10 point on 15 point lead with letter spacing (tracking) of 5
  • Alignment: left with first line indent of 12 px.

Once the style is created, make sure nothing in the document is selected and select the style from the Paragraph Styles panel. This sets the style up as the default style for the document. 

Figure 3. Detail of paragraph styles to be created 

Using Based On

Next, with the Body style selected, create all paragraph styles that will use it as its based on style. Basing Body_NoIndent on Body makes sense as it is the same with the exception that it does not have a first line indent. Basing Subhead on Body may not seem as logical since there are a number of properties that are not the same. The style attribute of interest here for based on is the font (Myriad Pro) which will be the same. Attributes to change follow:

  • Color: Green, Style: Bold
  • Size: 14 point on 18 point lead with letter spacing (tracking) of 25
  • Alignment: left with 9 pts space below

Even with all of the changes, using based on assures that the font for the style will change if and when the font choice for Body changes.

Basing the style Info on Subhead uses similar logic. If the color for Subhead changes, the color for all styles based on it will also change. The other attributes needing to be set for Info are as follows:

  • Font: Courier Std Bold
  • Size: 8 pt on 12 pt lead with letter spacing (tracking) of 100
  • Alignment:left with 60 pts space after
  • Paragraph Rules: Rule below 1 pt solid; Color: Text Color (Green); Width: Column, Offset: 14 pts

Using Next Styles

Because the text for each of the major sections of the book will be set similarly (Subhead followed by Info, then Body_NoIndent, and then Body), the next paragraph property for each of the styles will be set:

  • Subhead: next style Info
  • Info: next style Body_NoIndent
  • Body_NoIndent: next style Body
  • Body: next style [Same Style] (Body)

Object Styles

To accommodate the next style paragraph styling, an object style using the paragraph styles as set above will need to be created. Access the Object Styles panel from the Window menu (Window > Styles > Object Styles).

In the Object Style Options dialog name the style StoryText and base it on [Basic Text Frame].

With the Paragraph Styles option checked in Basic Attributes check Paragraph Styles and click on the entry. This opens the Paragraph Styles panel. In its drop down select the Paragraph Style Subhead and check Apply Next Style

To maintain the 16 pts of spacing between a text frame with this style and the one above, check the EPUB and HTML entry under Export Options. In its panel, check Custom Layout: Alignment and Spacing and set the value for space above to 16 px. Because the Export Options for Object Styles is new with Creative Cloud a screen shot of the EPUB and HTML option panel is shown below.

Figure 5: Alignment and Spacing settings for ePUB and HTML export


There are more paragraph styles and a few more object styles that need to be created before the document is complete, but these will be covered in future blogs when topics such as images and table of contents for ePub are discussed.

For now save your document as a template named TravelGuide; in a secure location on your computer. A suggested location is a folder named Templates in the same folder as the InDesign application.

You may want to experiment with the template. From InDesign’s File menu, choose New > Document and choose the template. This creates a new untitled document using the template. Create a text frame in the document and assign the StoryText object style to it. Enter text in the text frame using a paragraph return each time a paragraph style change is required (use a forced line return otherwise). Your text frame should look similar to Figure 4 below.

Figure 4: Text created in text frame styled with object style use its paragraph styles.