Re: epub3 formatting help
Hussein Shafie <[email protected]> Fri, 18 Oct 2024 10:37:27 +0200
| Newsgroups | gmane.editors.xxe.general |
|---|---|
| Message-ID | <[email protected]> |
Z. wrote:
>
> I am trying to do a simple epub3 formatting by making all paragraphs
> justified as the
> first step of customization.
>
> In the customize document conversion stylesheets menu, I have:
>
> XSLT Stylesheet: use dita-config:xsl/epub/epub3.xsl
> CSS Stylesheet: use myepub3.css, which contains the following:
>
> q@charset "UTF-8";
>
> @import url(__stock_epub.css);
>
> /* ADD YOUR STYLES HERE */
>
> *.body* .p {
> margin-top: 1em;
> margin-bottom: 1em;
> *text-align: justify;*
> }
>
> After the epub file is generated, I inflate it and find resources/
> epub.css has the same contents
> as myepub3.css, which makes me feel good.
>
> However, when I view the epub file using calibre on Linux, the
> paragraphs are not justified.
> I also tried to use .p { ...} without .body. I even modified base.css
> to inclue: text-align: justify for the p class.
>
> Nothing works. I must have done something wrong or maybe XMLMind has
> some special requirement. But the website
> at XMLMind does say text-align: justify is supported although it also
> says: *Justify and left are aliases*.
> See https://www.xmlmind.com/xmleditor/_distrib/doc/csssupport/
> csssupport.pdf <https://www.xmlmind.com/xmleditor/_distrib/doc/
> csssupport/csssupport.pdf>. So maybe it is not supported?
>
Document, "XMLmind XML Editor - Support of Cascading Style Sheets (W3C
CSS)" is about CSS support by XXE itself, that is, in the styled view of
XXE. It is not related in any way to CSS support by EPUB readers like
Calibre or Apple Books.
After looking at the "base.css" I sent you, it seems that:
---
.body .p {
margin-top: 1em;
margin-bottom: 1em;
text-align: justify;
}
---
is OK.
I used the procedure I told you about in my previous email and tested
this as follows:
0) Open or create a DITA map.
1) Select "Options|Customize Configuration|Customize Document Conversion
Stylesheets".
2) Select "EPUB".
3) Click "Customize" to create the CSS customization file (attached
"base_custom.css").
4) Click "Edit" to populate this file with CSS styles. I've added:
---
.conbody .p,
.refbody .p,
.taskbody .p,
.body .p {
margin-top: 1em;
margin-bottom: 1em;
text-align: justify;
color: red;
}
---
(.body is found only in <topic>, not in <concept> for example.)
And it worked for me in
- the EPUB reader, an add-on of Firefox,
- Calibre 5.44 on Windows.
In attached screenshots, notice that you may have less div.p elements
than you might think. For example, list items are not given a red text
color.
---
PS: I've noticed that some EPUB readers override some of the CSS styles
found in the EPUB by their own CSS styles (the rationale being probably
to make the EPUB more readable).
--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support
base_custom.css
(text/css, 226 B)
@charset "UTF-8";
@import url(__stock_epub.css);
/* ADD YOUR STYLES HERE */
.conbody .p,
.refbody .p,
.taskbody .p,
.body .p {
margin-top: 1em;
margin-bottom: 1em;
text-align: justify;
color: red;
}
EPUB_reader_in_Firefox.png
(image/png, 501.5 KB) - not displayed
Calibre_on_Windows.png
(image/png, 70.3 KB) - not displayed