| Type: | "auto", "avoid" or "always" |
|---|---|
| Inherited: | no |
| Used By: | All block elements |
| Default: | "auto" |
| See: | page-break-inside |
Whether to allow or avoid page breaks before or after the current element.
These attributes are used to keep elements together on the page - for example, the h1 element has page-break-after set to "avoid", to prevent the h1 tag from being separated from the tag immediately following it.
Prevent the caption from being separated from it's table
<table page-break-after="avoid">
<tr>
<td>Column 1</td>
<td>Column 2</td>
</tr>
</table>
<p>The table caption</p>
The same result!
<table>
<tr>
<td>Column 1</td>
<td>Column 2</td>
</tr>
</table>
<p page-break-before="avoid">The table caption</p>