HighDots Forums  

Page breaks in tables

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Page breaks in tables in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Andreas Prilop
 
Posts: n/a

Default Page breaks in tables - 08-29-2008 , 11:02 AM






Firefox 3 (like older versions) ignores

TR { page-break-before: always }

for the first row of a TBODY. Sample page:

http://www.unics.uni-hannover.de/nhtcapri/temp/1000.html
Choose "Print Preview".

Internet Explorer 6/7 prints every row onto a new page;
Firefox does not. Is this an obscure bug? Or is FF right?

Btw:
IE 6/7 ignores page breaks with TBODY altogether.

--
Bugs in Internet Explorer 7
http://freenet-homepage.de/prilop/ie7-bugs.html

Reply With Quote
  #2  
Old   
Joshua Cranmer
 
Posts: n/a

Default Re: Page breaks in tables - 08-29-2008 , 11:32 AM






Andreas Prilop wrote:
Quote:
Firefox 3 (like older versions) ignores

TR { page-break-before: always }

for the first row of a TBODY. Sample page:

http://www.unics.uni-hannover.de/nhtcapri/temp/1000.html
Choose "Print Preview".

Internet Explorer 6/7 prints every row onto a new page;
Firefox does not. Is this an obscure bug? Or is FF right?
CSS 2.1 states that only block-level elements (which TR is not) must
support page-break, while other elements (table rows are an example) may
support it. So I'll go off of CSS 3's draft here
(<http://dev.w3.org/csswg/css3-page/>).

§9.4 says:
In the normal flow, page breaks may occur at the following places:

1. In the vertical margin between sibling block boxes (or rows in a
table). When a page break occurs here, the used values of the adjoining
‘margin-bottom’ and ‘margin-top’ properties are set to ‘0’.
2. Between line boxes inside a block box.

A table row is not a block box, so that means that the page breaks are
allowed there only by the parenthetical. Since before the first row is
not between rows, the page break is technically not allowed there.

The distinction is a fine one, however, and it might warrant opening up
an issue on the W3C CSS mailing list.

--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth


Reply With Quote
  #3  
Old   
Stan Brown
 
Posts: n/a

Default Re: Page breaks in tables - 08-29-2008 , 06:50 PM



Fri, 29 Aug 2008 11:32:45 -0400 from Joshua Cranmer <Pidgeot18
@verizon.invalid>:
Quote:
CSS 2.1 states that only block-level elements (which TR is not) must
support page-break, while other elements (table rows are an example) may
support it. So I'll go off of CSS 3's draft here
(<http://dev.w3.org/csswg/css3-page/>).
Que? If table rows are not identical to TR, then what are they?

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2.1 spec: http://www.w3.org/TR/CSS21/
validator: http://jigsaw.w3.org/css-validator/
Why We Won't Help You:
http://diveintomark.org/archives/2003/05/05/why_we_wont_help_you


Reply With Quote
  #4  
Old   
Joshua Cranmer
 
Posts: n/a

Default Re: Page breaks in tables - 08-29-2008 , 07:04 PM



Stan Brown wrote:
Quote:
Fri, 29 Aug 2008 11:32:45 -0400 from Joshua Cranmer <Pidgeot18
@verizon.invalid>:
CSS 2.1 states that only block-level elements (which TR is not) must
support page-break, while other elements (table rows are an example) may
support it. So I'll go off of CSS 3's draft here
(<http://dev.w3.org/csswg/css3-page/>).

Que? If table rows are not identical to TR, then what are they?
Let me explain it more clearly.

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.

--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth


Reply With Quote
  #5  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: Page breaks in tables - 08-30-2008 , 06:50 AM



Joshua Cranmer wrote:

Quote:
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">second 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



Reply With Quote
  #6  
Old   
Andy Dingley
 
Posts: n/a

Default Re: Page breaks in tables - 09-01-2008 , 06:12 AM



On 30 Aug, 11:50, "Jukka K. Korpela" <jkorp... (AT) cs (DOT) tut.fi> wrote:

Quote:
IE does not even support display: table-row
Can you please clarify what you mean by this?

"IE does not (correctly|fully)? support the behaviour specified for
display: table-row on anything including <tr>"

or

"IE only supports the behaviour for display: table-row for the HTML
element <tr> and nothing else. It is not selectable by specifying
display: table-row through CSS for any other element."


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.