CSS page-break-before
The page-break-before property in CSS is used to specify whether a page break should occur before an element when printing. This property can be applied to various elements, such as headings, paragraphs, divs, and more.
There are three possible values for the page-break-before property:
auto: The browser determines whether a page break should occur before the element.always: A page break will always occur before the element.avoid: A page break will not occur before the element.
Let's see some examples of how the page-break-before property works:
In this example, the page-break-before: always; property is applied to a div element, which means that the content will always start on a new page when printing.
Here, the page-break-before: avoid; property is applied to an h2 element, which prevents a page break before the heading when printing.
Experiment with different elements and values for the page-break-before property to control page breaks in your printed documents.