W3C home > Mailing lists > Public > www-style@w3.org > April 2008

[CSS21] page-break-inside

From: Bert Bos <bert@w3.org>
Date: Wed, 16 Apr 2008 16:45:08 +0200
To: W3C style mailing list <www-style@w3.org>
Message-Id: <200804161645.08690.bert@w3.org>

(ISSUE-35)

If I understand Fantasai's proposal correctly, the ultimate goal is to 
add relative strengths to page break opportunities in level 3, so that 
the author can indicate between two undesired break points which is the 
lesser of two evils. (In level 2, if it has to be one or the other, the 
UA would probably take the one closest to the end of the page, for lack 
of any other information.)

Relative strengths is a good goal, I think. E.g., you neither want to 
break a page after the first line of a paragraph, nor inside a two-line 
section header, but if it has to be one or the other, then take the 
former. (A level 2 UA always takes the latter, because 'orphans' is 
stronger than 'page-break-inside'.)

The question is what is the best definition for level 2, given that we 
don't know yet how to introduce the strength factor in level 3 and we 
don't want to hold up level 2 until we do.

Fantasai expects that one of the additions in level 3 will be a value
for 'page-break-inside' that increases or decreases the
"undesirability" of a page break inside an element relative to its
parent element. The default should be neutral (neither stronger nor
weaker than its parent). And that default should be the same in level
2 and in level 3 (under the principle that level 3 can't change the
meaning of level 2 rules).

That's a reasonable expectation, although without considering 
how 'widows', 'page-break-before' and others are extended, we don't 
know if a different approach might be better (e.g., 
a 'page-break-strength' property that applies to all page break 
opportunities of an element, whether from 'widows' or 
from 'page-break-before').

The current definition of 'page-break-inside' says that the property
is inherited. From the viewpoint of the hypothetical level 3 model
with multiple levels of break strength, that means that what is
inherited is an absolute strength value. This is similar to how
'font-size' works: it inherits font sizes such as '12pt' and when you 
use the keyword 'larger' or a percentage it inherits the resulting 
absolute size.

Fantasai proposes to not inherit 'page-break-inside', but instead treat 
the default value of 'auto' as meaning "neither increase nor decrease 
the strength" and to interpret 'avoid' as setting a certain medium 
level of strength. We don't have a good analog of that in CSS yet, but 
there is some resemblance with 'text-decoration' and 'display: none', 
in that once they are set, descendants cannot get rid of their effect.

Either way, inherited or not inherited, it is possible to add keywords 
in level 3 to change the strength. The difference is that with the 
non-inherited version a child element in *level 2* cannot allow more 
breaks then its parent, because there is no third keyword in level 2. 
(In the inherited version, the keyword 'auto' has that function.)

To fix that, Fantasai proposes that the 'auto' keyword should be 
interpreted as "decrease the strength slightly" rather than "neither 
decrease nor increase." However, that has the undesirable effect that 
the strength of breaks inside

    <div style="page-break-inside: avoid">
      text
    </div>

is different from

    <div style="page-break-inside: avoid">
      <div>
        text
      </div>
    </div>

Saying that 'auto' only decreases the strength in level 2, but not in 
level 3, is not good either, because then there is a difference between 
level 2 and level 3.

Is it a problem that a child element cannot allow more page breaks than 
its parent? After all, 'page-break-inside' is typically set on small 
elements, such as a short PRE or a short note with a border around it. 
And all UAs should eventually implement level 3 with its new 
keywords...

Indeed, I think it is a small problem. But why should we introduce a 
small problem and forbid a possible use when the other solution, 
inheritance, has no such problem, is just as extensible, and, 
furthermore, has been the rule since 1998?



Bert
-- 
  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos                               W3C/ERCIM
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France
Received on Wednesday, 16 April 2008 14:45:46 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:05 GMT