The Frustration of an Epub CSS File

The creation of an ebook—or more specifically, an epub—begins with a designer. One of the most common programs to create the files for printing an ebook or a book is through InDesign, which can be found on the Adobe website. Book designers using the program can alter fonts, spacing, page numbers, and images. However, the designers don’t always edit the files of the created epub, and that’s an issue. Ebook editors become a part of the design process when they must edit the CSS file.

CSS stands for Cascading Style Sheets, and the file is created when the ebook editor or the designer converts the InDesign files into an epub. To get to the CSS file, the epub must be converted into a zip folder and extracted. Inside of the extracted file, you will find three things: the META-INF folder, the OEBPS folder, and a mimetype file. Inside the OEBPS file, there is a CSS folder, and once inside, you will have finally found the idGeneratedStyles.css file that controls the stylistic elements of an epub. The CSS file starts off with a list of fonts used in the InDesign file, then the underlying design elements (like margins that are globally applied), headers, paragraph styles, and finally, smaller elements like character styles or object styles. (To find examples on how to use CSS, I would suggest visiting the W3Schools website.)

Now, the issue of design as an ebook editor occurs when the epub file must be cleaned up. By “cleaned up,” I mean unnecessary tags removed. When I took the ebook production course at Portland State University, this meant generated tags like divs, idContainer_s, idGenObjectStyleOverrride_s, idGenObjectStyleLayout_s, CharOverride_s, and spans. For the most part, these can be removed without affecting the appearance of an epub.

If the above-mentioned tags were removed from the HTML files in the OEBPS, then the CSS lines of code that used those tags would no longer be applicable. Imagine if someone got rid of all the span tags, including span class=”italics”, in all of the HTML files. Getting rid of the span tags means that the CSS file won’t be able to stylize the words previously marked by those tags. Of course, you can probably determine that the span class=”italics” tag indicated words that were supposed to be italicized and go back and fix them, but other tags may not be that obvious. And even with the previous example, it can be frustrating if you have to start over from when you deleted the tags. If you’re editing an epub file, you should always check the CSS file before getting rid of multiple tags. Find out how the text appears due to the CSS, and if it’s not necessary for the ebook, get rid of it. If the tag is necessary, replace it with one more appropriate; the span class=”italics” example I used above, for instance, could be replaced with tags for italics.