Dealing with page breaks

Forcing a page break

The simplest way to force a page break to happen is using CSS. You can use the page-break-before property to define a class like this:

CSS
.page-break {
  page-break-before: always;
}

You can then apply this class to any element you want to insert a page break before.

Preventing a page break

If you want to avoid a section of your document from being broken between pages, you can use the page-break-inside CSS property to do so:

CSS
.avoid-page-break {
  page-break-inside: avoid;
}

If you apply this class to an element, it will have no effect for an element that is in the middle of the page but if it risks being broken between two pages, it will insert a page break before it.

Last updated