XML technologies / ePUB / ePub für (In)Designer / Repeated tasks / Setting font size
(Excerpt from “ePub für (In)Designer — Mit InDesign Schritt für Schritt zum E-Book” by Sascha Heck & Yves Apel)
HTML repeatedly needs values for font sizes, spacing and dimensions. Several units are possible, such as pixels (px) or percentages (%). One especially important unit, used by default in ePub, is em. The em unit has no fixed size and is relative to the device or browser’s default font size. It scales proportionally when text size changes, useful in dynamic layouts. A 10-pixel indent always stays 10 pixels; an em indent grows with the text and keeps the overall appearance more harmonious.
One em can therefore differ between devices or programs unless the document specifies a size. To do so, open the ePub’s template.css file and insert this line anywhere:
body {
font-size:12px;
}Here “12px” is the starting value: 1 em equals 12 pixels, 2 em equals 24 px, and so on. Our experience shows this works very well in iBooks, but may look small in Adobe Digital Editions. If that is your main target, 14 px or 16 px is more suitable.
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
back to top