I would like to have a page break inside the last but one paragraph of a chapter so that:
I tried to apply page-break-before: avoid; to the last paragraph and page-break-inside: auto; to the last but one paragraph, but it doesn’t seem to work.
Do you have a solution to solve that question?
Here is an example. If you set the margin to 2.5cm instead of 2.0cm you will get the correct result. But I would like to achieve this result without changing anything to the format.
- The last line is not alone on the last page.
- The last but one paragraph is not entirely on the last page (thus leaving a big blank on the last but one page).
I tried to apply page-break-before: avoid; to the last paragraph and page-break-inside: auto; to the last but one paragraph, but it doesn’t seem to work.
Do you have a solution to solve that question?
Here is an example. If you set the margin to 2.5cm instead of 2.0cm you will get the correct result. But I would like to achieve this result without changing anything to the format.
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>page-break-inside</title>
<style type="text/css">
@page{ size: A5; margin: 2.0cm; }
</style>
</head>
<body>
<p>source:
<a href="http://en.wikipedia.org/wiki/Serendipity_(book_series)">
http://en.wikipedia.org/wiki/Serendipity_(book_series)</a></p>
<p>Serendipity is a series of children's books about animals and other creatures. The books were written by Stephen Cosgrove (born July 26, 1945) and illustrated by Robin James. The books are short stories with colorful illustrations that have a moral perspective.</p>
<p>Cosgrove wrote the books after searching for an easy to read book with a message to read to his then three year-old daughter. After finding primarily large expensive books, Cosgrove teamed up with illustrator James to create low cost softcover books. After receiving an offer to publish the books only in hardcover, Cosgrove created his own publishing company - Serendipity Press. The first four books of the Serendipity Series were released in 1974. They are: Serendipity, The Dream Tree, Wheedle on the Needle, and The Muffin Dragon. Cosgrove merged Serendipity Press with the publishing company, Price/Stern/Sloan-Penguin/Putnum in 1978 so that Cosgrove could focus on writing. Cosgrove decided to re-edit his earlier books, which have been republished with the changes. To date, there are 70 books in the series, written from the kindergarten to grade three levels.</p>
<p style="page-break-inside: auto; color: firebrick;">The animals in the Serendipity series include bears, cats, dogs, horses, squirrels, rabbits, and mythical creatures such as unicorns, dragons, sea monsters, and pegasus. Cosgrove also invented his own creatures such as the wheedle, hucklebug and kritter. The books present moral issues such as growing up, disabilities, abuse, fear, friendship, prejudice, gossip, and helping the environment.</p>
<p style="page-break-before: avoid;">At least 25 of the books were translated into Spanish (based on the list in El Dragon Gloton).</p>
</body>
</html>
Edited by nico