View Single Post
Old 09-30-2013, 03:31 AM   #5
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,558
Karma: 19620479
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by Melchett View Post
2) I have three sections of front matter-
a) bookname and the author name
b) copyright and publisher name
c) dedication
I want all of these three things to appear separately. I am using the css property page break always to achieve this. All the three are starting on a new page but I want all of them to appear in the middle. The margin top feature seems not to work here. Any idea how to start these three sections in the middle.
That's the reading software chosing to implement the CSS spec in a way you don't like, but perfectly legal (emphasis mine):

When a forced page break occurs here, the used value of the relevant 'margin-bottom' property is set to '0'; the relevant 'margin-top' used value may either be set to '0' or retained.

You are forcing a page break, and the top-margin of the following element is converted to zero. There are several workarounds:

- Split the front matter in three files. The reading software will always insert a pagebreak, and the top margins will be retained.

- Use padding-top instead of margin-top, padding is not changed by pagebreaks. This may not be an option if you are using borders, for instance.

- Insert the pagebreak through a dummy element, something like this:

Code:
div.pagebreak { height: 0; page-break-before: always; }

<p>Last paragraph o a page.</p>
<div class="pagebreak"/>
<p>First paragraph of the next page.</p>
(Some readers may ignore empty <div>s, in that case write <div class="pagebreak">&nbsp;</div> instead.) The <div>'s margin-top is set to zero, but not the following paragraph's.
Jellby is offline   Reply With Quote