Page MenuHomePhabricator

Add page break rules to the "print" style-sheet
Closed, DeclinedPublic

Description

CSS2 defines special page break properties that can force or prevent page breaks from occuring:
http://www.w3.org/TR/CSS21/page.html#page-break-props

Whenever an article has a section heading, such as <h2>, a special rule can prevent it from being the last line in a printed page. By keeping headlines on the same page as the text they are heading, the text is easier to read.

Particularly, I'm suggesting the addition of this rule:
h2, h3 { page-break-after: avoid; }


Version: unspecified
Severity: enhancement

Details

Reference
bz12972

Event Timeline

bzimport raised the priority of this task from to Lowest.Nov 21 2014, 10:03 PM
bzimport set Reference to bz12972.
bzimport added a subscriber: Unknown Object (MLST).

why not to use it for h1 and h4 then?

Those as well :)

Though h1 is already at the top of the page. I can't think of a use-case where it matters.

Do browsers actually implement this?

I use { page-break-before: always } on a personal wiki. It works perfectly for me on Firefox 2 and Safari 3.

IE also supports this from its version 4. I think we're really going to implement this.

PS: Per http://reference.sitepoint.com/css/page-break-before IE's support is partial, but that doesn't matter here, because the value "always" is supported by all these browsers.

ayg wrote:

Reverted in r30910. The applied style was probably not what was intended: it added a line break before every single heading, necessary or not. The style we would want is page-break-after: avoid;, but I'm not convinced this would be useful. Only Opera seems to implement it (maybe IE also?) -- but the thing is, the CSS standard suggests that this rule be present by default:

http://www.w3.org/TR/CSS21/sample.html

So unless someone can show that this actually changes the behavior of some browser, IMO, this should be WONTFIX. Adding rules that aren't tested but make us feel all warm and fuzzy and standards-compliant has proven to be a bad idea in the past (e.g., my ingenious addition of a completely broken handheld stylesheet until one of the folks at Opera politely asked for us to remove it months later because it was screwing up display of Wikipedia).

ayg wrote:

(In reply to comment #7)

a line break before every single heading

That's "page break", of course.

Thanks, Simterical. I think I should have given it a little bit more research beforhand.

(In reply to comment #7)
I agree to the WONTFIX. I didn't realize it was the default recommended CSS behavior.

ayg wrote:

Then it seems no one disagrees. I'll mark this WONTFIX until someone comes up with a reason why this is useful; if you think you have, reopen.