Page-break-before: auto doesn't work for me .... why?

Hi my buddies for solving time consumption problems,

I use css to create a page that pops into PDFand and contains a set of mailboxes ready to print commands.

However, some boxes are between pages and cut in half.

I found the following ...

http://www.w3schools.com/Css/pr_print_pageba.asp

... which does not work for me on a car, other values โ€‹โ€‹are not suitable.

Page spits out divs whict: float: left with content inside div

layout:

[div] [div] [div]

[div] [div] [div]

[div] [div] [div] <The last div spills over two pages

each div had a page break before: auto, but divs are still split into 2 pages.

Why does this not work for me?

You can help?

0
css printing
source share
4 answers

I managed to get this work by applying

page-break-after:always;page-break-before:always; 

However ... I feel that the mVChr solution will work for others as well, but not in my case.

Many thanks

0
source share

To get the desired behavior, you may need to add attributes:

 div * { page-break-before:avoid; page-break-after:avoid; } 

to avoid page tearing between all elements inside your divs

+3
source share

Try page-break-inside:avoid . I believe page-break-after:avoid; and page-break-before:avoid not implemented. See: https://developer.mozilla.org/en/CSS/page-break-before

+2
source share

Make sure that the containing <div> not inline-block . It seems that displaying your div as inline-block might interfere with page-break-auto: auto .

0
source share

All Articles