💭 page-break-after - CSS: Cascading Style Sheets | MDN

!https://developer.mozilla.org/en-US/docs/Web/CSS/page-break-after

page-break-after - CSS | MDN
The page-break-after CSS property adjusts page breaks after the current element.
MDN Web Docs · developer.mozilla.org

I’m working on something that might go to print, so I want the page breaks to happen somewhat in my control as the content author. As I do my writing I break my content up in to many short sections using h2, sometimes an h3. These are generally short sections that go together, should stay together, and typically are not too lengthy to cause a large white space in print.

I found a way in css to only allow page breaks to happen on h2 and h3, and it turned out perfect, suck it WSIWIG editors

* {
  page-break-before: avoid;
}

h2,
h3 {
  page-break-before: auto;
}

Note

This post is a thought. It’s a short note that I make about someone else’s content online #thoughts

Connections

Related tags and posts connected to this entry.