Preventing vertical margin collapsing across page breaks

"Robert Gibbins" <[email protected]>
Newsgroups gmane.culture.literature.e-books.gutenberg.volunteers
Message-ID <9315991F45B04C1FB9EA968FE29A6F48@ThinkPadE13A>
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.

I had to think of this myself, once I realised what the problem was, and it
does feel a bit like an ugly kludge (for example the zero height line still
has a non-breaking space at its start). I wonder if any one knows a better
way to achieve the same end.

Bob Gibbins

_______________________________________________
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.