View Single Post
Old 01-16-2011, 09:47 AM   #3
cybmole
Wizard
cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.
 
Posts: 2,984
Karma: 1285294
Join Date: Sep 2010
Device: Kobo aura HD, Kobo Arc, Kindle Fire HDX 8.9 , Kindle for PC
Quote:
Originally Posted by jackie_w View Post
In your html snippet the chapter heading is contained in <h2>...</h2> tags. Is there anything in the CSS which specifically references h2?

Also the <h2> tag is a child of <body class="calibre" ...> and so will (I think) inherit styling from entries in the CSS such as
Code:
body or
body.calibre or
.calibre
I'm not sure about the first 2 but there is almost certainly an entry in the CSS for .calibre.

You could try and fix it during the original conversion by putting something like
Code:
h2 {margin-top: 0;}
in the ExtraCSS box on the Look&Feel page.
nice hypothesis but nothing in stylesheet for h2, and the calibre entry has margin top set to zero:
.calibre {
display: block;
font-size: 1em;
margin-bottom: 0;
margin-left: 5pt;
margin-right: 5pt;
margin-top: 0;
padding-left: 0;
padding-right: 0;
page-break-before: always

I'd like to nail the cause before getting into the workarounds. could be as simple as understanding "BLOCK" means to Kindle software ?

i google html block & find this:
display: block

display: block means that the element is displayed as a block, as paragraphs and headers have always been. A block has some whitespace above and below it and tolerates no HTML elements next to it, except when ordered otherwise

so kindle & sigil book view apply the above - hence white space above

now here is one with no white space
Code:
<body class="calibre" style="">
  <div class="calibre1" id="filepos960107">
 <p class="calibre7"><span class="calibre5"><span class="bold"><span class="calibre8">Chapter 5</span></span></span></p>
styles:
.calibre {
display: block;
font-size: 1em;
margin-bottom: 0;
margin-left: 0;
margin-right: 5pt;
margin-top: 0;
padding-left: 0;
padding-right: 0;
page-break-before: always
}
.calibre1 {
display: block
.calibre5 {
font-size: 1.125em
}
.calibre7 {
display: block;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
text-align: center;
text-indent: 0
}
.calibre8 {
color: red


here, calibre7 has an explicit margin top 0 - I guess that over-rides the default ( inherited? )meaning of block, but if that's true, then why did it not apply in example 1 ?

Last edited by cybmole; 01-16-2011 at 10:00 AM.
cybmole is offline   Reply With Quote