Advertisement

Your Ad could be here. I want to connect my readers to relavant ads. If you have a product targeted at developers, let's talk. [email protected]

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