Re: Preventing vertical margin collapsing across page breaks

Marcello Perathoner <marcello-ULrl/Sucve/[email protected]>
Newsgroups gmane.culture.literature.e-books.gutenberg.volunteers
Message-ID <[email protected]>
On 11/02/2012 07:29 PM, Robert Gibbins wrote:
> Some time ago I realised that although one can (at least in an epub reader)
> force a "page break" by dividing an html page into multiple divisions, each
> of which has the style {page-break-before: always}, the (vertical)
> margin-bottom of the last element in a previous page and the margin-top in
> the succeeding page collapse into each other using the usual HTML rules on
> vertical margin collapsing.
> The practical effect of this is that unless the last element of the previous
> page is exactly at the bottom of that page, the margin-top of first element
> of the succeeding page effectively does not appear in the succeeding page.
> Currently I get round this problem by starting each division which forces a
> page-break with:
> <div class="margin-top-anchor>&nbsp</div>
> Where the css contains:
> div.margin-top-anchor {line-height: 100%; margin-top: 0em; margin-bottom:
> -1em}
> i.e. so that each division starts (I hope) with a zero height line which
> 'anchors' the margin-top of the next element onto its own page.

div.chapter { page-break-before: always }
h2          { padding-top: 1em }

<div class="chapter">
   <h2>Chapter II</h2>

The div will start a new page and the padding-top will not collapse with 
the margin-top of the page thus giving a little extra room at the top of 
the page.




Regards

-- 
Marcello Perathoner
[email protected]
_______________________________________________
gutvol-d mailing list
gutvol-d-4LCm/o+qPMZ96Xl/[email protected]
http://lists.pglaf.org/mailman/listinfo/gutvol-d
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.