0

Last 24 hours I spent on figuring out how to control widows/orphans but without using widows and orphans selectors in my CSS. Believe it or not, but Kindle Oasis and Paperwhite for that matter (though I don't have this device at hand) use AZW3 files that do not support either widows:2 or orphans:2 or even break-after:avoid. My text has subheads that, if viewed on Kindle, get left behind at the bottom of the pages. I tried KFX, yes, and it is better in terms of layout (widows/orphans and breaks are supported) but KFX has another problem which is a deal-breaker for me - it underlines every link whether you specify text-decoration:none or not. I have about 2000 links in the text that I don't need underlined. Back to the problem - AZW3 doesn't have support for widows/orphans and page breaks. Can someone suggest how to go about accomplishing this:

p {
 widows:2;
 orphans:2:
}

or

p {
 break-inside:avoid;
}

without the above CSS in order to control where text breaks on Kindle devices. Thank you.

Michael
  • 75
  • 9

1 Answers1

0

The only way I found how to force the lines to stay together, i.e. to imitate the break-inside:avoid; behavior, is to put an html element such as img which doesn't break across pages behind my text. Example:

<img src="transparent.png" style="height:3em;width:auto;"/>
<h style="margin-top:-2.5em">this is my header</h>
<p>this is my paragraph</p>

Notice that my PNG is called "transparent" - because that is all it is - a transparent square. My margin-top is slightly less than the height of the image thus still leaving some space above the header. Spacing can be modified with regular margins. Interestingly, this works well on Kindle Fire and Kindle Oasis where <h> and <p> text is forced to go to next page together because of the height of the image. Pending a better implementation of page-break and widow/orphan control on Kindles, this is probably the only way to control this behavior.

Michael
  • 75
  • 9