How are the page-break properties in CSS supposed to work?

Tags: css,printing

Problem :

Modern browsers are supposed to support the CSS page-break properties to some degree. However I haven't been able to get any browser to print any differently when I use avoid, widows, or orphans. Am I doing it wrong, or is the browser support just not as solid as advertised?

      h2 {
        page-break-after: avoid;

      p {
        page-break-inside: avoid;   
        orphans: 2;
        widows: 2;

Solution :

Browser support for printing sucks. Not just a little bit, but completely totally and without compare. About once every other year (for the past 10), I've played around with this and I always come back to the same conclusion: don't depend on the browser to be able to handle good printing.

If it absolutely must be positioned correctly, create a pdf file on the fly and let the user print that.

    CSS Howto..

    (CSS) Set Id for Class How to Use

    How to parse a specific link using a Selector CSS Query

    How to get a picture randomly move and turn towards the changing direction around a page? (using jQuery & css)

    How do I add extra slides to this pure CSS text rotator?

    Wordpress Plugin - How can I make the text responsive, OR replace it with a new div?

    How do I create a CSS class Union?

    How to index star rating in google?

    jQuery slideshow with separate div containing image specific text

    How can I animate a DOM element using transitions with dynamic values?

    How to make element sizes to fill cell sizes and increase font in free jqgrid inline and form editing

    How can I invoke an “AktionLink” in an “onClick” event in a “div”?

    Changing opacity for div in div - is this possible? How?

    How to create a standing up 3D text effect with Css3 transforms

    How to set height of child div while hovering over a parent div in css?

    jquery how to make an element comeback to initial position after animation

    How to remove some css properties without the paticular one using regular expression?

    CSS: How to make background color around text not flush to the text?

    how to set two div's height equal with css

    jQuery: How to add a string to a css property

    How to base the height of a

    on whether or not its parent div has an image

    How to prevent javascript and css messing up?

    how to use tinymce content.css in rails

    How to make all borders the same color?

    How to fill the width under an image with a caption without defining the width of the caption?

    c# cassette - how to create different css bundles for different pages

    How to center the center circle?

    CSS Position Help (horizontal sidebar showing up when animate content over)

    How to CSS style a table such that its width is within [min, max] percent of page width and as wide as necessary?

    How to enlarge a div without moving other elements

    How to override css img properties?