Join Rufus Deuchler for an in-depth discussion in this video Understanding style mapping, part of Creating Ebooks with InDesign CS5.
The secret of a successful ePub export, is the thorough application of paragraph and character styles, throughout the entire InDesign document. So to understand how you're paragraph and character styles will actually be re-purposed in the ePub file format, and actually be mapped to a cascading style sheet, ACSS, maybe it's worth having a look at the XHTML, the HTML file produced for the ePub, and the CSS, the Cascading Style Sheet that is included in the ePub file.
Later in this course, you will learn about how you can access that information yourself, for viewing it and even editing it. So to create this example, what we will do is simply create a text frame here inside of my InDesign document, I will zoom into here, and write a phrase such as maybe, this is bold text. And one thing I want to do here is to actually apply a character style to just the word bold. Let's go here to the character styles. Create a new character style by clicking on the the button here. Opening it by double-clicking on the style itself, and then give it a name, such as bold in this case, and the only thing I want to change here is actually the font style.
I'm going to go in here and start typing the word bold and here it is. So this is the only thing that is actually changing, everything else remains, only that the font style is now bold. So let's say Okay to this, and this is now being applied to just that word. Very good. At that point, what I will do is export just this little phrase to the ePub format, and we will have a look at it. So file Export for, ePub. We will go into all of these windows in much greater depth at a later stage, so just bear with me.
I'm going to save that inside of my chapter two folder. Just make sure to view the ebook after exporting, and also generate the CSS. That's the only things I'd worry about right now. So let's export this, and the file opens in digital additions, and we can already see that, yes, this text now looks bold. Let's move over into our folder, and you see that the ePub file automatically took the little icon of the Adobe Digital additions in my case, but what we want to do is actually open it with another application called Sigil. So I can control click on it, and choose open with Sigil, the latest version, 3.2 in that case.
So let's open it. This is my view inside of Sigil, and you can see that I see my XHTML file here. This is bold text, and you can see that, in fact, the word bold is actually set in bold. Also, if I twirl open the styles folder, we see that we have a CSS, a Cascading Style Sheet. So let's have a look at both. First of all, let's look at this XHTML file. And one really cool thing about Sigil, is that you can look at the code.
So let's look at the code, let's go into Code View and see what InDesign actually generated. So first of all, we see that we have a lot of HTML descriptions here. For example, we have a whole zone up here called, head with a title, and it picks up the title of my document. And it also links, and this is very, very important to understand, it links to a CSS, which is right here. And that CSS, which we will be looking at in a second, actually defines how the text looks inside of my document. Also, down here, we have a whole part called body, and this is actually what we can view inside of our reader.
This is where the text actually is, and we can actually see it here. This is, I'm going to select it for you to see better, this is, and then we have the word bold, and then, text. Perfect. The part that's interesting to us here is this one, span class bold. Okay? And this means that we are applying a style to just that word. A style called, bold. So if we move over to our CSS, by double clicking on it, we see that in fact down here we have a CSS definition called, span bold, and basically what it does it puts the font weight to bold. Okay? So all of that information came from our InDesign document and was brought into the ePub. As an XHTML file, which we have looked at right now, and the CSS. So, the key benefit of CSS, is that the file is actually external to the actual content.
The various XHTML files that we have here, and which make up the ePub. Meaning that, if you need to make changes in the formatting of a large book, for example, you can do it all in one place. And all of the documents will be updated with your styling changes, as they all reference back to that one single CSS file. Also, if we look at the CSS file a little bit closer, and look at the other options that we have here, we see that there is quite some things that we can format in the XHTML file, and the CSS file. For example, here, we can define the font family, which specifies the font family for the text as in maybe havetica, or a series of font families to allow for substitution when one family isn't present.
Or the readers device for example, doesn't have times or times new roman, or serif. Okay? So we can really define the appearance of type. However, remember that font family is not supported by all readers. So, in our case, we will actually be ignoring that definition up here. And then, one that we've already learned about, down here, font weight bold, we can define the font weight of the text. In that case, we can have it bold, or not bold.
Font style allows us to define the text as being italics or not. Font size is of course the size of the characters of your text, of the text within the paragraph. In this case InDesign expresses them in m's. But we will also learn that we can define them in other sizes, for example, in pixel sizes, or even percentages. Line height is the property that specifies the line height, or the letting between lines of text.
Text decoration is the property which defines the decoration added to the text. For example, underline or strike through. Then we have the possibility for a font variant, which allows us to define whether text is set in small caps or not. Text indent, is the indent of the first line of each paragraph, and this is also something we can define, we can do that in the M measurement unit or even in pixels.
Text alignment, which of course can be left, center or right, or even justified. We can also set the color of the text, and this is something that we will be looking at later on, but setting the color of the text can make it very difficult to read the text on specific devices. For example, if a reader of a ebook chooses to view the text in white on a black background. If we actually set the color of the text to black, which it is in this case, the devices are not able to actually change the color of the text, though your user would find himself with, or herself with black text on a black background. Therefore, totally unable to read the text.
And then we can also apply a margin. The margin properties, that's all the margins for a paragraph. The top margin, left, and right, and bottom margins. This is, however, not intended as the margin of the viewing area of the ePub. The margins of the page, like you would think in the traditional books. But it's more an inset of the text within the margins of the page, and within the text flow. Well this is pretty much it. (LAUGH) These are the properties that we can actually work with, these are the very few attributes you can use to format your text. However, you need to know that not all of these attributes work on all Ebook readers.
So the best way to know what works and what doesn't, is to test the ePub extensively on all of the various devices or applications that we've also been seeing before, for example Kindle Previewer, or even Adobe Digital Editions to see exactly how your book will look. So, coming back to InDesign, the important thing that I want to explain here is that all of the character styles and paragraph styles that you set in InDesign will actually carry over to the ePub, within the CSS file.
- Creating a new InDesign document with EPUB in mind
- Working with text
- Creating hyperlinks and cross-references
- Working with graphics
- Defining the reading order of the EPUB
- Other essential parts of an ebook
- Exporting to EPUB
- Customizing an EPUB