Questions tagged [page-break-inside]

a CSS property that defines page breaks inside the current element such as avoid

Description

The page-break-inside CSS property adjusts page breaks inside the current element.

Syntax

page-break-inside: value;

where value can be either,

auto - Initial value. Automatic page breaks (neither forced nor forbidden)

(or)

avoid - Avoid page breaks inside the element.

Example

/* avoid page break inside the paragraph */
p { 
    page-break-inside: avoid;  
}

References

  1. W3C Specification
  2. MDN Link
69 questions
30
votes
6 answers

Page-break-inside:avoid not working

I have a print stylesheet for my (Wordpress) site, and I want images to print on a single page rather than being split across pages. In some cases, even lines of text are being split across pages. I've included img {page-break: avoid;) in my print…
Katie Fritz
  • 883
  • 2
  • 9
  • 14
29
votes
3 answers

How to get `page-break-inside: avoid` to work nicely with `flex-wrap: wrap`

I am trying to get page-break-inside: avoid to work in a form that uses a multi-line flexbox layout (with flex-wrap: wrap). The goal is simply to avoid breaking form questions when printing. This works well with a single line flexbox or without a…
16
votes
7 answers

Which browsers support page break manipulation using CSS and the page-break-inside element?

I'm trying to use the page-break-inside CSS directive, the class of which is to be attached to a div tag or a table tag (I think this may only work on block elements, in which case it would have to be the table). I've tried all the tutorials that…
user20762
  • 161
  • 1
  • 2
  • 3
15
votes
1 answer

Wicked_pdf avoid page-break-inside not working

This is the result when i use Wicked_pdf to convert my html.erb page to pdf. Problem: Seem table 's tr has been splitted into two pages. What i tried without success: Use page-break-inside as described here or here table, tr, td, th, tbody,…
Nhat Dinh
  • 3,378
  • 4
  • 35
  • 51
13
votes
4 answers

How to separate body content with fixed header and footer for multiple pages

I Have three separate section as header, body and footer to create pdf. Header part will come always at top of each page and it will be fix. ______________________ | header | |______________________| Problem is with body content, if…
Drone
  • 1,114
  • 1
  • 12
  • 31
13
votes
2 answers

Safari page-break-inside:avoid not working

I have a problem with CSS page-break-inside: avoid. I have some printing blocks which have this css attribute set, however Safari breaks any content just as the real page break occurs, while it works in all other major browsers (current versions)…
patman
  • 2,780
  • 4
  • 30
  • 54
9
votes
2 answers

IText prevent row breaking across multiple pages using XML Worker

we are using iText 5.5.7 with XML Worker and have encountered an issue with long tables where rows that run off the end of the page are split in two over to the next page (see image). We have tried using page-break-inside:avoid; as suggested in…
owlyfool
  • 337
  • 3
  • 13
8
votes
4 answers

How to apply some styles to first and last elements on a print page?

I have the following dummy code: