Modern browsers are supposed to support the CSS page-break properties to some degree. However I haven’t been able to get any browser to print any differently when I use avoid, widows, or orphans. Am I doing it wrong, or is the browser support just not as solid as advertised?
h2 {
page-break-after: avoid;
}
p {
page-break-inside: avoid;
orphans: 2;
widows: 2;
}
Browser support for printing sucks. Not just a little bit, but completely totally and without compare. About once every other year (for the past 10), I’ve played around with this and I always come back to the same conclusion: don’t depend on the browser to be able to handle good printing.
If it absolutely must be positioned correctly, create a pdf file on the fly and let the user print that.