So the more I look into this, the more it looks like it's almost impossible to prevent all breaks after subheadings, even with "break-after: avoid" and the like.
I'm seeing one solution recommended, which is to wrap the heading and the first paragraph in a <div> with the appropriate CSS. But that seems like a lot of manual interventions and thus a lot of opportunity for error.
And I'm wondering how bad it would be to just insert a really small <p> (maybe line-height 0.15 or the like) before the headings, so that if a break had to happen it would happen there? Because the <p> would be self-contained, it seems a little less likely than a <div> to mess up the "real" text, and it would be easier to get rid of if for some reason it wasn't needed anymore.
It's not beautiful and it seems a bit like cheating, but would it actually break anything? If yes, please sing out and save me from myself!
|