danfickle / danfickle/openhtmltopdf
Orphan html elements
- Dominant language
- Java
- Stars
- 2.2k
- Forks
- 423
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I have a dynamic document which has some subheadings and variable length content below. In some cases, I get a heading placed at the end of one page, while the content starts in the next one. I tried to use `orphans` property, but during my tests I found it only works within the same tag.
So, how can I achieve this?
This is a small example to reproduce it, based on your annotated example. The desired effect would move "Title" to a new page, if there's no room for "Line 1" as well in the same page.
```html
.no-orphans {
widows: 0;
orphans: 2;
}
Title
Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
Line 9
Line 10
Line 11
```
NOTE: This is a small repro based on the example, but the real scenario replaces all the `
`'s content with `
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.