Search code examples
htmlcssxhtmlkindle

Preventing text from splitting over two pages


This html is at the end of ebook. When converting html to mobi, then preview ebook on Kindle, the above text at the end always splitted over two pages in ebook. As this is the last page, I want stop this text from splitting over pages. I think I should add around this text code the page-break-before:avoid or page-break-after:avoid property. I am not sure, which one suitable for use in this case, page-break-after:avoid or page-break-before:avoid?

<hr/>
<div>
<FONT SIZE=-1>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</FONT>
</div>
</body> 
</HTML>

For example, should I use this sample, or page-break-before:avoid?

<div style="page-break-after:avoid"></div>
<hr/>
<div>
<FONT SIZE=-1>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</FONT>
</div>
<div style="page-break-after:avoid"></div>
</body> 
</HTML>

Solution

  • You should actually be using this instead:

    page-break-inside: avoid;