Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 11-02-2021, 08:56 PM   #1
Section8
Addict
Section8 ought to be getting tired of karma fortunes by now.Section8 ought to be getting tired of karma fortunes by now.Section8 ought to be getting tired of karma fortunes by now.Section8 ought to be getting tired of karma fortunes by now.Section8 ought to be getting tired of karma fortunes by now.Section8 ought to be getting tired of karma fortunes by now.Section8 ought to be getting tired of karma fortunes by now.Section8 ought to be getting tired of karma fortunes by now.Section8 ought to be getting tired of karma fortunes by now.Section8 ought to be getting tired of karma fortunes by now.Section8 ought to be getting tired of karma fortunes by now.
 
Section8's Avatar
 
Posts: 264
Karma: 2121470
Join Date: Oct 2011
Location: Arlington, TX
Device: Kindle PW4, Moon+ Reader on a cheap Android tablet
Incomplete Live CSS in the editor

I am running Calibre 5.23 on Linux

Sometimes, when I have purchased a new ebook and am tweaking its formatting in the calibre editor, I will see situations where the "File preview" panel clearly shows some formatting "feature" that I want to change - such as big left and right margins - but the "Live CSS" panel will give no indication of the CSS rule causing this "feature"

I can usually just read through the CSS and figure out where the formatting is coming from, but I encountered this issue in this month's Tor.com free ebook, so decided to post this and see what the real issue is.

I have attached a small scrambled.epub file to this thread, which was built by deleting all the images and html files (except one) from this epub and then using the ScrambleEpub plugin to scramble the rest.

If you open this file in the Calibre editor, and then open "introduction.xhtml", you should see, in the File Preview panel, that it has unusually large left and right margins.

If you then click on any text in the editor, in the '<p class="TX">' class, you should see something like this in the "Live CSS" panel:

Code:
Matched CSS rules for p @20
OEBPS/styles/stylesheet.css  p.TX
font-style: normal 
font-weight: normal 
margin-bottom: 0px 
margin-left: 0px 
margin-right: 0px 
margin-top: 0px 
text-align: justify 
text-decoration-line: none 
text-decoration-style: initial 
text-decoration-color: initial 
text-indent: 1.4em 
--------------------------

Computed final style
font-style: normal 
font-weight: 400 
margin-bottom: 0px 
margin-left: 0px 
margin-right: 0px 
margin-top: 0px 
text-align: justify 
text-decoration-color: rgb(0, 0, 0) 
text-decoration-line: none 
text-decoration-style: solid 
text-indent: 28px 
--------------------------
This gives no indication of the cause of the huge margins.

In fact, it is this CSS rule:
Code:
div.body {
  margin: 0 5em 0 5em;
}
So why doesn't the Live CSS panel show that this CSS rule is involved in the formatting?
Attached Files
File Type: epub scrambled.epub (489.7 KB, 100 views)

Last edited by Section8; 11-02-2021 at 09:08 PM. Reason: Indicate Calibre version, platform
Section8 is offline   Reply With Quote
Old 11-02-2021, 09:17 PM   #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,353
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Live CSS shows yout the css that applies to the element and the css that is inherited from parent elements. margin is not an inherited property. If you specify a margin ona parent element, child elements dont get that margin also applied to them. It is true that visually it "looks like" the margin is applied to the child, but that's not actually the case.
kovidgoyal is offline   Reply With Quote
Advert
Old 11-02-2021, 09:20 PM   #3
Karellen
Wizard
Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.
 
Karellen's Avatar
 
Posts: 1,611
Karma: 9500498
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
The margins are being set by <div class="body"> at the top of the page

The CSS rule is as follows which is setting
Code:
div.body {
  margin: 0 5em 0 5em;
}
Yes, strange that when you click in <p> the <div> styling is not captured in Live CSS
Karellen is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
CSS support in the editor vFbjgBDhV Editor 5 11-03-2020 09:25 AM
Some css are automatically removed by Editor nqk Editor 6 07-20-2020 01:32 AM
Calibre editor e-reader html statusbar popup with css ni_cc Editor 5 03-15-2020 08:36 AM
a-z css editor solution rjwse@aol.com Editor 4 04-07-2018 01:09 PM
Tweak epub and Simple CSS Editor Shadowman123 Calibre 11 09-30-2010 10:07 AM


All times are GMT -4. The time now is 07:38 AM.


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