08-31-2009, 11:41 AM | #1 |
frumious Bandersnatch
Posts: 7,533
Karma: 19000001
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> In principle, "page-break-inside:avoid" would prevent any page break inside the stanza, but I don't want to be so restrictive... |
08-31-2009, 02:13 PM | #2 |
speaking for myself
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.
|
Advert | |
|
08-31-2009, 02:15 PM | #3 |
speaking for myself
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.
|
08-31-2009, 02:30 PM | #4 | |
frumious Bandersnatch
Posts: 7,533
Karma: 19000001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
That's what I feared.
Reading again the relevant part of the spec, tells me that's indeed the case: Quote:
|
|
08-31-2009, 03:38 PM | #5 |
Wizard
Posts: 1,244
Karma: 3439432
Join Date: Feb 2008
Device: Amazon Kindle Paperwhite (300ppi), Samsung Galaxy Book 12
|
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 |
Advert | |
|
08-31-2009, 03:54 PM | #6 |
frumious Bandersnatch
Posts: 7,533
Karma: 19000001
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
|
|
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 05:12 PM |
Windows and Orphans? | Catire | ePub | 5 | 06-29-2010 03:25 PM |
Basic CSS Font family question! | kjk | ePub | 2 | 05-27-2010 01:28 PM |
Widows and Orphans - Taking Control | Themus | Calibre | 2 | 05-24-2010 09:40 AM |
Google and the Zombie Army of Orphans | anurag | News | 2 | 03-30-2009 08:19 AM |