Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 08-31-2009, 12:41 PM   #1
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: 6,309
Karma: 4898871
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
A question about CSS: widows and orphans

The CSS and ePUB specifications support these two properties, widows and orphans, which set the minimum number of lines that must be left at the top or bottom of a page, i.e. to avoid leaving single lines at any of these places.

I don't know, however, how these properties work when they are specified for elements that contain other block elements inside, for instance:

Code:
<div style="widows=2;orphans=2;">
<p>I kiss the lips of no fair maid,</p>
<p>Nor wet mine with the foaming wine</p>
<p>Within the beaker’s gold.</p>
<p>A cheek upon whose rose-leaf shade</p>
<p>Mine eyes have lit a glow divine,</p>
<p>A look which shyly seeketh mine,</p>
<p>These leave me still and cold.</p>
</div>
The intent here is preventing a pagebreak that would cause a single line (the minimum is 2) appearing at the top or bottom of a page. But would this work or would a pagebreak be allowed anyway if it occurs after after a block element, <p>...</p>?

In principle, "page-break-inside:avoid" would prevent any page break inside the stanza, but I don't want to be so restrictive...
Jellby is offline   Reply With Quote
Old 08-31-2009, 03:13 PM   #2
Peter Sorotokin
speaking for myself
Peter Sorotokin knows what time it isPeter Sorotokin knows what time it isPeter Sorotokin knows what time it isPeter Sorotokin knows what time it isPeter Sorotokin knows what time it isPeter Sorotokin knows what time it isPeter Sorotokin knows what time it isPeter Sorotokin knows what time it isPeter Sorotokin knows what time it isPeter Sorotokin knows what time it isPeter Sorotokin knows what time it is
 
Posts: 139
Karma: 2166
Join Date: Feb 2008
Location: San Francisco Bay Area
Device: PRS-505
widow/orphan control won't work in that case.
Peter Sorotokin is offline   Reply With Quote
Old 08-31-2009, 03:15 PM   #3
Peter Sorotokin
speaking for myself
Peter Sorotokin knows what time it isPeter Sorotokin knows what time it isPeter Sorotokin knows what time it isPeter Sorotokin knows what time it isPeter Sorotokin knows what time it isPeter Sorotokin knows what time it isPeter Sorotokin knows what time it isPeter Sorotokin knows what time it isPeter Sorotokin knows what time it isPeter Sorotokin knows what time it isPeter Sorotokin knows what time it is
 
Posts: 139
Karma: 2166
Join Date: Feb 2008
Location: San Francisco Bay Area
Device: PRS-505
what you can do is to put page-break-after: avoid on the first p and page-break-before: avoid on the last one.
Peter Sorotokin is offline   Reply With Quote
Old 08-31-2009, 03:30 PM   #4
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: 6,309
Karma: 4898871
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by Peter Sorotokin View Post
widow/orphan control won't work in that case.
That's what I feared.

Reading again the relevant part of the spec, tells me that's indeed the case:

Quote:
In the normal flow, page breaks can occur at the following places:

1. In the vertical margin between block boxes. [...]
2. Between line boxes inside a block box.

These breaks are subject to the following rules:

Rule A: [...]
Rule B: [...]
Rule C: Breaking at (2) is allowed only if the number of line boxes between the break and the start of the enclosing block box is the value of 'orphans' or more, and the number of line boxes between the break and the end of the box is the value of 'widows' or more.
Rule D: [...]
It does not say 'widows' and 'orphans' affect breaks at (1), which is what I'd wish in this case.
Jellby is offline   Reply With Quote
Old 08-31-2009, 04:38 PM   #5
WillAdams
Guru
WillAdams ought to be getting tired of karma fortunes by now.WillAdams ought to be getting tired of karma fortunes by now.WillAdams ought to be getting tired of karma fortunes by now.WillAdams ought to be getting tired of karma fortunes by now.WillAdams ought to be getting tired of karma fortunes by now.WillAdams ought to be getting tired of karma fortunes by now.WillAdams ought to be getting tired of karma fortunes by now.WillAdams ought to be getting tired of karma fortunes by now.WillAdams ought to be getting tired of karma fortunes by now.WillAdams ought to be getting tired of karma fortunes by now.WillAdams ought to be getting tired of karma fortunes by now.
 
WillAdams's Avatar
 
Posts: 979
Karma: 1915000
Join Date: Feb 2008
Device: Sony PRS-600, Fujitsu Stylistic ST-4121
An ugly hack would be to make a non-breaking div of the first two lines, then one which was allowed to break of all but the last two lines, then a final non-breaking div of the last two lines.

William
WillAdams is offline   Reply With Quote
Old 08-31-2009, 04:54 PM   #6
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: 6,309
Karma: 4898871
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
I'm reluctant to use those "solutions", but thanks, anyway. I think I prefer either leave it alone or use "page-break-inside:avoid". It could be better if the ePUB spec supported the :first-child selector and if there were a :last-child one
Jellby is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Other Fiction Holmes, Mary Jane: The English Orphans. V1. 1 July 2010 crutledge Kindle Books 0 07-01-2010 06:12 PM
Windows and Orphans? Catire ePub 5 06-29-2010 04:25 PM
Basic CSS Font family question! kjk ePub 2 05-27-2010 02:28 PM
Widows and Orphans - Taking Control Themus Calibre 2 05-24-2010 10:40 AM
Google and the Zombie Army of Orphans anurag News 2 03-30-2009 09:19 AM


All times are GMT -4. The time now is 03:21 AM.


MobileRead.com is a privately owned, operated and funded community.