Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 10-29-2025, 10:35 AM   #1
LenaWolf
Junior Member
LenaWolf began at the beginning.
 
LenaWolf's Avatar
 
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?
LenaWolf is offline   Reply With Quote
Old 10-29-2025, 11:17 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
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.
kovidgoyal is offline   Reply With Quote
Old 10-29-2025, 11:27 AM   #3
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
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.
theducks is offline   Reply With Quote
Old 10-29-2025, 11:44 AM   #4
LenaWolf
Junior Member
LenaWolf began at the beginning.
 
LenaWolf's Avatar
 
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...
LenaWolf is offline   Reply With Quote
Old 10-29-2025, 12:02 PM   #5
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
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:
Originally Posted by LenaWolf View Post
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...
It was a good noob question. Calibre (and e-book interaction) has a huge amount of possible interactions.
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
theducks is offline   Reply With Quote
Old 10-30-2025, 10:15 AM   #6
Quoth
Still reading
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
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.
Quoth is offline   Reply With Quote
Old 10-30-2025, 11:32 AM   #7
LenaWolf
Junior Member
LenaWolf began at the beginning.
 
LenaWolf's Avatar
 
Posts: 5
Karma: 10
Join Date: Oct 2025
Device: Sony PRS-1
Quote:
Originally Posted by Quoth View Post
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.
I did try this route but it didn't work for me. Most of my text got messed up which is far more important than the few illustrations. The problem was with the conversion from ODT to DOCX - my text styles did not convert correctly. A better route would have been to convert from ODT to HTML first (save as HTML from LibreOffice), but frankly it is not necessary. Since I produce several formats and variants of the book, I prefer to have as few manual steps as possible.

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!
LenaWolf is offline   Reply With Quote
Old 10-30-2025, 02:47 PM   #8
Quoth
Still reading
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 15,008
Karma: 111111255
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
Quote:
Originally Posted by LenaWolf View Post
I did try this route but it didn't work for me. Most of my text got messed up which is far more important than the few illustrations.
Are you using styles properly? I've done the editing in ODT, extra save in DOCX (NEVER EDIT THAT) and import to Calibre for close on 10 years and maybe about 1000 times.
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.
Quoth is offline   Reply With Quote
Old 10-30-2025, 07:32 PM   #9
LenaWolf
Junior Member
LenaWolf began at the beginning.
 
LenaWolf's Avatar
 
Posts: 5
Karma: 10
Join Date: Oct 2025
Device: Sony PRS-1
Quote:
Originally Posted by Quoth View Post
Are you using styles properly? I've done the editing in ODT, extra save in DOCX (NEVER EDIT THAT) and import to Calibre for close on 10 years and maybe about 1000 times.
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.
LenaWolf is offline   Reply With Quote
Old 10-31-2025, 10:20 AM   #10
Quoth
Still reading
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
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).
Quoth is offline   Reply With Quote
Old 10-31-2025, 10:40 AM   #11
LenaWolf
Junior Member
LenaWolf began at the beginning.
 
LenaWolf's Avatar
 
Posts: 5
Karma: 10
Join Date: Oct 2025
Device: Sony PRS-1
Quote:
Originally Posted by Quoth View Post
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).
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.
LenaWolf is offline   Reply With Quote
Old 11-01-2025, 09:14 AM   #12
Quoth
Still reading
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
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.
Quoth is offline   Reply With Quote
Old Yesterday, 05:14 AM   #13
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
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
Quote:
Originally Posted by Quoth View Post
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.
Simple tables should not be that much of an issue.
JSWolf is offline   Reply With Quote
Old Yesterday, 05:58 AM   #14
Quoth
Still reading
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 15,008
Karma: 111111255
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
Quote:
Originally Posted by JSWolf View Post
Simple tables should not be that much of an issue.
It depends on content and width.
Quoth is offline   Reply With Quote
Reply

Tags
css stylesheet


Forum Jump

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


All times are GMT -4. The time now is 05:41 PM.


MobileRead.com is a privately owned, operated and funded community.