Joshua Cranmer wrote:
CSS 2.1 only explicitly requires that page-break be supported by
block-level elements. It also permits implementors to support other
elements, citing table rows (i.e., TR) explicitly.
So I never meant to imply a distinction between the two. Apologies if
it sounded otherwise.
But there _is_ a distinction between the two, even though it is mainly
conceptual and not that much practical.
The current excuse for a surrogate for an imitation of a standard for CSS,
namely the draft CSS 2.1 specification - which shall be cited as work in
progress only - says about page-break properties the following, among other
things:
"User Agents must apply these properties to block-level elements in the
normal flow of the root element. User agents may also apply these properties
to other elements, e.g., 'table-row' elements."
So what it mentions, as an example of other types of elements, apparently
means an element for which the display property has the value table-row.
This is at a conceptual level quite distinct from specific HTML elements.
Although a TR element can be expected to have display: table-row by default,
and this is suggested in the sample style sheet for HTML too, there is no
_requirement_ on this. In fact, IE does not even support display: table-row
but it still implements TR elements as rows of tables in the intuitive
sense.
Specifically, you can set the display value of TR to something else than
table-row, or set display: table-row for some other element - and at least
the latter may make perfect sense, especially when you are actually styling
XML and not HTML. This is way over the head of IE of course, but it's still
how things should work, and do work on supporting browsers.
Technically, if you set tr { display: block; }, then conforming browsers are
required to apply page-break properties. But this is not a good idea because
it may seriously break table formatting.
This gives me an idea... instead of setting page-break properties for a TR
element, why not put an auxiliary block element inside the first cell and
assign such a property to it. Compare:
<table>
<tr><td>first row</td></td></tr>
<tr class="foo"><td >second row</td></td></tr>
</table>
<table>
<tr><td>first row</td></td></tr>
<tr><td><div class="foo">sec ond row</div></td></td></tr>
</table>
Now if I set
.foo { page-break-before: always; }
then the second row of the first table _may_ appear at the start of a new
page, whereas the second row of the second table _must_ appear at the start
of a new page, on browsers playing by CSS 2.1 rules.
I'm not really surprised at seeing that this little trick, though apparently
it should work according to the "standard", fails miserably: on Firefox 3,
the behavior is just the opposite - setting page-break property on TR _is_
honored, setting it on a block element (inside TD) is ignored.
So much for "standards-compliance".
Yucca