Contents
Paged media (e.g., paper, transparencies, pages that are displayed on computer screens, etc.) differ from continuous media in that the content of the document is split into one or more discrete pages.
CSS 2.1 has three properties that indicate where the user agent may or should break pages, and on what page (left or right) the subsequent content should resume. Each page break ends layout in the current page and causes remaining pieces of the document tree to be laid out on a new page.
Value: | auto | always | avoid | left | right | inherit |
Initial: | auto |
Applies to: | block-level elements |
Inherited: | no |
Percentages: | N/A |
Media: | visual, paged |
Value: | auto | always | avoid | left | right | inherit |
Initial: | auto |
Applies to: | block-level elements |
Inherited: | no |
Percentages: | N/A |
Media: | visual, paged |
Value: | avoid | auto | inherit |
Initial: | auto |
Applies to: | block-level elements |
Inherited: | yes |
Percentages: | N/A |
Media: | visual, paged |
Values for these properties have the following meanings:
Whether the first page of a document is a left page or a right page is not defined in this specification. A conforming user agent may interpret the values 'left' and 'right' as 'always'.
A potential page break location is typically under the influence of the parent element's 'page-break-inside' property, the 'page-break-after' property of the preceding element, and the 'page-break-before' property of the following element. When these properties have values other than 'auto', the values 'always', 'left', and 'right' take precedence over 'avoid'.
These properties only apply to non-floating block-level elements. Also, page breaks cannot be forced to occur inside table cells, absolutely positioned boxes, and fixed positioned boxes. Page breaks set before, inside, or after such elements must be ignored.
In the normal flow, page breaks can occur at the following places:
These breaks are subject to the following rules:
If the above rules do not provide enough break points to keep content from overflowing the page boxes, then rules B and C are dropped in order to find additional breakpoints. If that still does not lead to sufficient break points, rule A is dropped as well.
A page break must occur at (1) if, among the 'page-break-after' and 'page-break-before' properties of all the elements generating boxes that meet at this margin, there is at least one with the value 'always', 'left', or 'right'.
CSS 2.1 does not define which of a set of allowed page breaks must be used; CSS 2.1 does not forbid a user agent from breaking at every possible break point, or not to break at all. But CSS 2.1 does recommend that user agents observe the following heuristics (while recognizing that they are sometimes contradictory):