View Single Post
Old 06-24-2020, 01:06 PM   #10
mcdummy
Connoisseur
mcdummy is a jewel in the roughmcdummy is a jewel in the roughmcdummy is a jewel in the roughmcdummy is a jewel in the roughmcdummy is a jewel in the roughmcdummy is a jewel in the roughmcdummy is a jewel in the roughmcdummy is a jewel in the roughmcdummy is a jewel in the roughmcdummy is a jewel in the roughmcdummy is a jewel in the rough
 
mcdummy's Avatar
 
Posts: 73
Karma: 7130
Join Date: Apr 2015
Device: PRS-T3
Quote:
Originally Posted by JSWolf View Post
It's not Calibre's fault you botched the CSS. <div class="center"> is going to do nothing because you don't have any class in the CSS for that.
That's the basic point: calibre is happy if any definition for a class name (in my example p.center) used in the html exists in the css, even if the class definition in the css has no effect on other elements using a class with the same name (<div class="center"> in my example).

Therefore, although the <div class="center"> is not doing anything, since the corresponding definition is missing in the css, calibre is not removing the "center" class from <div class="center"> since the CSS contains a p.center defintion, which, as pointed out, has no effect on the <div class="center">

So when you use the calibre tool, you assume that all classes in the html have a corresponding defintion in the CSS even if this is not the case.

P.S.

I didn't botch the CSS. I downloaded the book and checked the book for errors. During the check I noticed by coincidence that the html contains both <div class="center"> and <p class="center"> and that calibre does not remove the class from <div class="center">, since the CSS contained a p.center definition.
mcdummy is offline   Reply With Quote