Previous Message
Next Message

CSS bug or browser bug?

Sent by Syntactic: Jim Wilkinson on 29 April 2005 09:09


Hi Peter,

> At http://www.captainclassfrigates.co.uk/honours/ubs.html using
> http://www.captainclassfrigates.co.uk/print.css when printing or using
> "print preview" FireFox 1.0.3 displays the Introductory paragraph fine
> but then displays the data table underneath it on a new page where as
> Opera & IE both show it correctly printing the table on the page after
> the introductory paragraph.

I confirm your findings (in FF1.0 and Opera 8.0). You're up against two  
issues: (1) what the CSS2 and CSS2.1 specs say about page breaks; (2) what  
the browsers actually do.

Firefox's behaviour is not wrong according to the CSS spec, even though  
it's not sensible. Browsers are allowed some discretion in where to put  
page breaks. FF is probably trying to observe the spec's guideline "avoid  
breaking inside a table". But the table doesn't fit on a single sheet  
anyway, so FF's logic is flawed.

As I'm sure you know, CSS provides for page-break-* properties (e.g.  
page-break-inside) and you can use these to influence browser behaviour.  
They apply to block-level elements, such as <table>. So you could try the  
following:-

/* Try to persuade browsers that it's permissible to split table */
table {
page-break-inside: auto;
}

But browser support for the page-break-* properties is poor, except in  
Opera [1], so your "persuasion" will probably be ignored by FF.

You probably don't want browsers to split rows. However, it looks as  
though the page-break-* properties can't be applied to <tr> since it's not  
strictly a block-level element [2]. The following rule would do no harm,  
though. It's ignored by all browsers except Opera, which honours it  
nicely:-

/* Try to persuade browsers that rows may not be split */
tr {
page-break-inside: avoid;
}

Hope this helps. As far as Firefox goes, I think you're out of luck.

[1] <http://css-discuss.incutio.com/?page=PrintStylesheets> "Page breaks"  
section

[2] <http://css-discuss.incutio.com/?page=PrintingTables> "Controlling  
page breaks" section

I'll try to look at your second (IE) problem shortly.

-- 
Jim Wilkinson

Cardiff, Wales UK

Opera e-mail client: http://www.opera.com/mail/
______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread: