I have a large HTML document with headers (h1, h2, h3...) and paragraphs. When I print the document, I want that, automatically, headers at bottom of document go to next page:
How can I do? I use "orphans: 3" CSS with paragraphs and works with "p" tags, but with h1 or h2 don't work.
@page {
size: A4;
}
p {
orphans:3;
}
h1, h2 {
orphans:3
}
Full example on action where:
- 1-2 page: paragraphs orphan works fine.
- 2-3 page: headers don't works.
Requirements:
- HTML have one main div container.
- Don't alter HTML.
- Browser support isn't important (on my specific job).
- I need some trick in CSS (no JS or Jquery, preferably)
- I can't use page-break-before:always because I want that headers only go to next page when appears at bottom of page.