Note

This post is a thought. It's a short note that I make about someone else's content online. Learn more about the process thoughts

Here's my thought on πŸ’­ page-break-after - CSS: Cascading Style Sheets | MDN


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;
}

This post was a thought by Waylon Walker see all my thoughts at https://waylonwalker.com/thoughts