I’ve been head deep into EPUB… and wanted to share another finding with InDesign CS5.5. A short post only, because I’m in the middle of work 🙂
InDesign CS5.5 now recognises character styles that are applied through nested styles and GREP styles during EPUB export. That’s very cool! It adds a span tag with class references to the style names by default, when leaving the Export Tagging, Tag setting set to [automatic] and Class field left empty.
FWIW I’m not promoting using the [automatic] setting with class field left empty as a ‘best practice’… 🙂
There is however one exception: Drop Caps. When using a drop cap that’s formatted through the Drop Caps and Nested Style feature, no <span> tag is added to the resulting html inside the EPUB. The Drop Cap is basically totally ignored…
So I applied the Drop Cap character style over the top of the already formatted Drop Cap, and left the Tag set to [automatic], but added a Class name “dropcap”
After Exporting the EPUB and taking a look at the HTML that was generated I saw this:
Hmmm…. so I removed the Drop Cap reference within the Paragraph Style…
And exported the same document again, leaving the character style applied to the initial cap and with Export Tagging defined as before and ended up with the same result as earlier. As a last step, I forced the Tag option to span and exported once more…
Same result once again.
Wanted to share this finding. It’s not a major issue, as the matching style declaration is also added to the template.css, but it just makes a bit harder to develop a reusable template.css file for publications, when this char-style-override occurs. (Note, that I had the Include Style Overrides option in EPUB Export dialog deselected during all of this).
Cari, I am using CS5. I need to have different character styles within different paragraphs, however, when applied and viewed as EPub, it is holding the size with it. My paragraph styles aren’t (which is what I want for e-readers). Do you have any suggestions.
Bottom line: I can’t seem to bold something within a paragraph and keep the flexibility of font size and type that comes with e-readers.
Help and Thanks
it sounds to me like the Characters Styles are containing font, size etc. information and overwriting what the paragraph style should be doing… And possibly a character style is applied to all of the paragraph text?
Create paragraph style, apply it to some dummy text,
Now for the character styles, just make a change to some of the text formatted with the paragraph style
Next create a new character style. The Style Settings should indicate that only those overrides that you added to the paragraph style are part of the character style.
Hope this is of help,
Yep, you’d need to fix these at HTML/CSS level.
I’m not aware of any generic .css for iBooks being available. Generally publishers will custom build these for their publications and set-up mapping guides to their style-names in InDesign etc.
So…I guess you’re saying that Drop Caps don’t export or display with InDesign CS 5.5? Mine aren’t, either. It would appear that you have manually added a style to your exported CSS file called “span.char-style-override-1”, is this correct?
Second question: I’d like to find a generic CSS template for the iBook app – is there such a thing? I’ve been searching the web…didn’t find anything. I’ve been trying to copy the ePubs on my iPad to my computer to open them up and look at their CSS but haven’t figured out how to do that, either! Any help is appreciated.
Good day Cari
Ebooks I publish from Indesign CS5.5 do not centre the book title on the title page. If I edit the book using Sigil and enter a before the title, the problem is rectified – but then Sigil takes away the TOC. Can I not use nested styles to add the ?
Many thanks if you could help.
You’re absolutely right about that. The use of a nested style or GREP style definitely doesn’t add the float:left; property to the style declaration that is added. Which makes me think that is finding might be something that Adobe’s gotta work on a bit more in a future release.
As long as that drop-cap is a true drop cap the char-style-override will be generated.
So for the time being we’ll just need to keep an eye out for those char-style-overrides. And hope at some point that the drop-cap style name referenced in InDesign will be as the class-value in the resulting HTML. Especially for those of us building generic template.css files that can be used across publications.
“char-style-override” is generally generated, if you work with drop caps oder the image exportoption within a paragraph.
The benefit of the real drop cap is, that in CS5.5 the float element and margins are generated during the export. That is not the case, if you use a nested style.
Also, to Bob:
First-letter won’t do it if you’re formatting fiction, because many chapters start with dialogue. Consider this opening line:
“‘Tis lovely!” she cried.
In that case, you may very well choose to drop-cap the first three characters. GREP can handle it easily, but a rigid “first letter” rule won’t.
@Keith That’s an excellent work-around, especially when working in a workflow that uses a pre-defined template.css that contains the declaration.
It would mean removing the drop-cap from InDesign altogether, and just applying the nested/GREP style instead for EPUB export purposes. This would affect the layout of the InDesign file.
As long as there’s a true-drop-cap there, InDesign will generate the char-style-override.
*updated this comment 12-May // CJ
I’m still on CS4, so maybe I’m missing something, but why not use the nested feature instead of the drop-cap feature?
That is, apply the character style “dropcap” to the first character of the paragraph?
Do GREP styles also get recognized during export? Because if they do, that could let you automatically apply “dropcap” where needed.
If they’re not recognized, you could still build and save a GREP search/replace that you could run on all open documents (i.e., all chapter files at once) to apply “dropcap” to the first letter OR open-quote-plus-letter OR open-quote-plus-apostrophe-plus-letter that occurs in paragraph style “body-first.”
If it does work you could really simplify the code in your case. If the drop cap style only takes place in the first paragraph after an h1 you could have a CSS rule for “h1+p:first-letter”
Again, though, this would really need some testing.
For the document I’m working with there’s only 1 drop cap per chapter, so I basically added a style declaration for span.char-style-override-1 🙂
The issue with drop-caps in EPUB is also that you don’t quite know how things are going to look esp, with different font support for different devices, plus font-size variations.
Like your sample I used % in font-size and float:left 🙂
I’m snowed under with work, so can’t really test the pseudo element atm, but not sure if that is supported with EPUB 2.0.1 … maybe once EPUB goes ‘CSS3″?
Does EPUB support the firstletter .psuedo element? (I know Adobe Digital Editions doesn’t but I think EPUB does) If so, you could set a dropcap class for those paragraphs and then add the CSS.
font-size : 300%;
font-weight : bold;
float : left;
color : #c00;
This should certainly be tested on the target devices before using.