XML technologies / ePUB / ePub für (In)Designer / Editing lists afterward / Replacing bullets with a custom graphic

(Excerpt from “ePub für (In)Designer — Mit InDesign Schritt für Schritt zum E-Book” by Sascha Heck & Yves Apel)

If you prefer a special symbol instead of ordinary bullets, the e-reader must be able to display it. The only reliable way to include it in ePub is converting it into a graphic. This stops being a true list, however: ePub defines it as an ordinary paragraph with a <p> tag. The special symbol survives, but indentation is lost and following lines no longer align correctly.

Initial InDesign example with a custom bullet

Figure: We want a list with a custom symbol
as shown here in InDesign.

Graphic bullets in ePub: misaligned lines

Figure: HTML contains ordinary <p> tags,
not an unordered list. Lines do not align.

Combine both benefits: preserve the HTML list and replace bullets with graphics. Create a normal bulleted list in InDesign and export it as unordered lists.

ePub export: map to unordered lists

Figure: ePub export: map to unordered lists.

ePub in Sigil: a true list

Figure: In Sigil, the HTML list is a
true list with <li> entries.

Each <li> element has the class Aufzaehlung in this example. We use it to address the list in CSS.

Adding the graphic

The graphic must exist in ePub’s Images folder. Create it first if needed. Our example uses a Minion font ornament. Put it in its own InDesign text frame and assign the desired color. Select the frame using the black arrow and choose Type → Create Outlines. This yields only the symbol, without white space.

Create the graphic in InDesign, then outline it

Figure: Create the graphic in InDesign, then outline it.

With the frame still selected, choose File → Export and JPEG format. In the export dialog, choose Export → Selection to export only the selected symbol as JPEG.

In Sigil, right-click Images and select the JPEG just generated in InDesign to add it to the image folder.

Sigil: add an image by right-clicking the image folder

Figure: Sigil—add an image by right-clicking the image folder.

Editing CSS

With the graphic available, edit CSS by adding these lines:

li.Aufzaehlung {
  list-style-type: none;
  background: url('../Images/bild_liste.jpg') no-repeat top left;
  padding-left: 2.5em;
}

After li. comes the list-item class name, Aufzaehlung in our example.

list-style-type: none; hides the ordinary bullets.

The third line inserts our added graphic. Single quotation marks enclose the image path.

padding-left specifies indentation, controlling the distance between symbol and text.

Adobe Digital Editions: correct symbols and aligned lines

Figure: Adobe Digital Editions—symbols display correctly
and lines align.

Symbols may not yet be vertically centered on each line. Correct this by adding the line background-position as follows:

li.Aufzaehlung {
  list-style-type: none;
  background: url('../Images/bild_liste.jpg') no-repeat top left;
  padding-left: 2.5em;
  background-position: 0em 0.3em;
}

The first value sets horizontal position, the second vertical position. Experiment until the symbol sits where desired.

Adobe Digital Editions: vertically adjusted symbols

Figure: Adobe Digital Editions—symbols adjusted vertically.

  

 

 

 

back to top