Avoiding page breaks within element

break-inside

Specify page layout and column layout behaviour within this element.

Property values

This property is used to specify whether the layout of text can be split across columns or pages, either allowing or preventing this element from splitting across boundaries.

Use one of these keywords:

auto Allows the page layout or column layout to insert a break within this element, but never forces the break.
avoid Prevents the page layout or column layout from inserting a break within this element, forcing all of its text to remain together.
avoid-page Prevents the page layout from inserting a page break within this element, forcing it all to remain together on the same page.
avoid-column Prevents the column layout from inserting a column break within this element, forcing it all to remain together in the same column.

Examples

This example allows column breaks on any paragraph except the first two and last two:

column p {            
break-inside: auto;
}
column p:nth-of-type(-n+2) {
break-inside: avoid-column;
}
column p:nth-last-of-type(-n+2) {
break-inside: avoid-column;
}
break-inside
0

style > paging > break-insideAvoiding page breaks within element

🔗 🔎