I am unable to get this CSS to work in Chrome & Firefox.
p { page-break-inside: avoid; }
h1 { page-break-after: avoid; }
Html:
<h1>FOO</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<h1>FOO</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
[..]
Chrome & Firefox will insert a page break after the <h1>
element when printing.
Only IE keeps h1+p together.
The HTML is generated (by https://github.com/chjj/marked) so I'd rather like to solve this by CSS if possible.
- JSFiddle: http://jsfiddle.net/QCvA5/86/
- Output: http://jsfiddle.net/QCvA5/86/show/