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.
Figure: We want a list with a custom symbol
as shown here in InDesign.
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.
Figure: ePub export: map to unordered lists.
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.
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.
| 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.
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.
Figure: Adobe Digital Editions—symbols adjusted vertically.
Copyright © dpunkt.verlag GmbH 2012
You may print the online version for your private use.
Otherwise, this chapter from “ePub für (In)Designer” is subject to the same terms as the printed edition: the work and all its parts are protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
dpunkt.verlag GmbH, Wieblinger Weg 17, 69123 Heidelberg, fon 06221-14830, fax 06221-148399, hallo(at)dpunkt.de
