CSS Tricks: box-decoration-break
When a box is split between multiple pages, do you want do display its top and bottom borders? Sometimes you do… but sometimes you don’t.
As often, CSS has good news for you: box-decoration-break
:
article {
box-decoration-break: clone;
}
This feature lets you display the borders at the top and the bottom of the box, even when it’s split. Of course, you’ll also keep the padding inside your box.
With the default value, slice, you’ll be able to keep the default behavior that’s more common: keep borders and padding on the left and right sides, but skip them at the top and the bottom of the pages.
Note that at page breaks, split boxes always reach the bottom of the page, even if their content is too small to fill the whole blank space.
And don’t hesitate to try this feature with inline boxes, it works very well too if you want to keep your borders when your text breaks across multiple lines!
span {
box-decoration-break: clone;
}
Learn more about box-decoration-break
: