|
|
#1 |
|
Junior Member
![]() Posts: 5
Karma: 10
Join Date: Oct 2025
Device: Sony PRS-1
|
Extra CSS ignored when converting ODT -> EPUB
Hello,
I have seen many messages about this problem going back years, but unfortunately I was unable to solve it. I have Calibre 8.13 and I am converting from ODT to EPUB. I would like to add extra CSS and according to the manual I should be able to just type it in the window during conversion under Look and Feel -> Styling -> Extra CSS. I have done this but it is not included in the stylesheet.css for my book. I've tried both raw CSS and a path to a file, and can't get it to work. Here is my CSS (very simple): .calibre5 { max-height: 90%; max-width: 100%; } I suspect I'm doing something wrong. How can I get it to work, please? |
|
|
|
|
|
#2 |
|
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,609
Karma: 28549044
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
.calibre5 is not a class in your input document. extra css applies to the input document. calibre5 is a generated class in the output document. Read this https://manual.calibre-ebook.com/con...l#introduction if you want to understand how conversion works.
|
|
|
|
|
|
#3 |
|
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,269
Karma: 61916422
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Calibre5 is NOT applicable to every book.
Conversion generates these calibre# codes (in sequence) as it detects the need. This 'extra' may work fairly well if you only use the same publisher. But I would never count on it. It seems the quality of (original) coding, even with a House stylesheet is junk. I've seen whole books coded class="frontmatter" because the person who coded had no clue and just used the first style that had the attributes I find it easier to adjust each stylesheet as needed. Way less fiddling. ctrl-mouse-click on the style= you wish to adjust, and the calibre editor jumps to that in the stylesheet. |
|
|
|
|
|
#4 |
|
Junior Member
![]() Posts: 5
Karma: 10
Join Date: Oct 2025
Device: Sony PRS-1
|
Thank you both! I did read the manual, but there's a difference between reading and understanding...
I have now reviewed it and actually what I was tryng to achieve is get the images to fit on the screen, so I adjusted my CSS to add those max-height and max-width values for <img> instead. This works! I can see the code inserted in the appropriate class which now happens to be .calibre4, and I now understand what is happening! Apologies for a noob question... |
|
|
|
|
|
#5 | |
|
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,269
Karma: 61916422
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
The 80% rule applies. Most will do it the same, basic way. Then ther is the 20% that just had to do tricks the end up with you to figure out how/what
|
|
|
|
|
|
|
#6 |
|
Still reading
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 15,008
Karma: 111111255
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
|
Also saving an extra docx copy from LO Writer from the odt is best. Edit odt, but import docx to Calibre.
The css for images will often still need an edit. |
|
|
|
|
|
#7 | |
|
Junior Member
![]() Posts: 5
Karma: 10
Join Date: Oct 2025
Device: Sony PRS-1
|
Quote:
I am now able to correctly position and scale images with automatic conversion from ODT to EPUB using that extra CSS and a few style corrections. So far, so good!
|
|
|
|
|
|
|
#8 | |
|
Still reading
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 15,008
Karma: 111111255
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
|
Quote:
All TOC, pagebreaks, text formatting 100% perfect and only some larger images (anchor as character and larger ones in separate paragraphs) need CSS edited. Add no extra whitespace. Set all margins/spacings via styles. No blank lines or tabs. |
|
|
|
|
|
|
#9 |
|
Junior Member
![]() Posts: 5
Karma: 10
Join Date: Oct 2025
Device: Sony PRS-1
|
Yes, I do use styles properly. I think I just never investigated this route sufficiently because there was never any need. I don't work with Word and this is just an additional unnecessary step for me. I have only started using Calibre now, I never needed export to ePub, so this is all new to me and undoubtedly I am making many beginners' mistakes. So thank you for helping me! But like I said, I now have a perfect conversion directly from ODT to EPUB through CSS rules in Calibre, including images, formatting, etc. So there is no need for me to investigate DOCX as an intermediate step.
|
|
|
|
|
|
#10 |
|
Still reading
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 15,008
Karma: 111111255
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
|
I've never seen perfect ODT to epub without an extra "Save As" in docx (which is messed up if you edit it in OpenOffice / LibreOffice).
|
|
|
|
|
|
#11 |
|
Junior Member
![]() Posts: 5
Karma: 10
Join Date: Oct 2025
Device: Sony PRS-1
|
I'm sure it depends on what is in your document. I mean, types of styles, frames, graphics, document layout - there are so many things that can mess up your output. Which is why we have those various ways to fine-tune the conversion with rules, extra CSS or even HTML editing. I use those. I figured them out for my particular document, and so far I was able to do everything I needed for a perfect EPUB output that does NOT require any manual correction afterwards. This is important to me because I generate several versions of content based on the same source files which are all ODT (made with LibreOffice). The entire book is a composite of multiple files, and the EPUB version is just one of several. Having to manually edit EPUB output would have me do those edits over and over again every time I update the source documents - and I am still writing and editing, so there are frequent updates. Each manual step is a maintenance nightmare.
|
|
|
|
|
|
#12 |
|
Still reading
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 15,008
Karma: 111111255
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
|
Frames and columns mostly don't work anyway, Tables are tricky.
I create epub and I don't edit it, except some sizes of images CSS. The odt conversion to epub is absolutely less good than docx. Only takes a few seconds to create an extra docx save. I only edit odt. |
|
|
|
|
|
#13 |
|
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 80,786
Karma: 150249619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Simple tables should not be that much of an issue.
|
|
|
|
|
|
#14 |
|
Still reading
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 15,008
Karma: 111111255
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
|
|
|
|
|
![]() |
| Tags |
| css stylesheet |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Extra data in CSS when converting from MS Wod | kumarashantanu | Conversion | 2 | 03-03-2021 06:17 PM |
| Converting odt to ePub | Jane Eyre | Workshop | 17 | 10-30-2019 12:22 PM |
| Calibre converting portrait odt to landscape epub | MarjaE | Conversion | 4 | 11-20-2017 10:35 AM |
| ODT -> Epub odd css behaviour | BobC | Conversion | 2 | 03-18-2013 07:56 AM |
| Converting ODT to EPUB/LRF | banjomike | Calibre | 2 | 10-03-2009 05:32 PM |