Page 1 of 1

widows and orphans

Posted: Thu Jul 19, 2018 5:38 pm
by shudson310
The Chemistry documentation describes a style to control page breaks based on widows and orphans. The example only shows <p>, but is this possible with other elements? For example, I don't want an orphaned line from a step.

I tried:

Code: Select all

p, tr, ul, ol, steps, step, substep, li {
orphans: 4;
widows: 2;
}
but I'm still getting orphaned step content.

How can I address this?

Re: widows and orphans

Posted: Fri Jul 20, 2018 9:58 am
by Radu
Hi Scott,

From what I understand the widows and orphans strategies apply to paragraph-like elements, so only to block elements which contain inside text and inline elements.
So if you have a very large <p> somewhere at the end of the page and its content overflows the page, then these properties are taken into account.
But if you have a step, the step contains in its turn other block elements (cmd, info (maybe inside the info there are other paragraps)) and this set of widow/orphan properties to not apply when deciding if a split between cmd and info should be made or not, or a split between two paragraphs inside the info should be attempted or not.

Regards,
Radu

Re: widows and orphans

Posted: Wed Jul 25, 2018 9:16 pm
by bloodnok
Although it sometimes generates unwanted whitespace, I found using "page-break-after: avoid;" mostly keeps my steps together.

Code: Select all

li.step:before{
content: "Step " counter(item) ": " !important;
counter-increment: item;
font-weight: bold;
page-break-after: avoid;
}

Re: widows and orphans

Posted: Tue Jul 31, 2018 12:13 am
by shudson310
Thanks! That was very helpful. Works well for our tasks, too.