View Single Post
Old 07-24-2025, 09:03 PM   #3
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,827
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by PilcrowandStanza View Post
Hi all,

There has to be a simple fix for this, right?
Titles/headers at the bottom of the page with the text starting on the next.

How to keep them together! I use CSS "page break: avoid" to little luck.
Is there extra code that needs to be added?

Or do we simply accept that ebooks are wonky?

Thanks
Employ the following style:

1. In your .css stylesheet:

Code:
.noBreakAfter {
    -webkit-column-break-after: avoid; /* This is for epub3, epub2 ebooks will ignore it */
    page-break-after: avoid; /* This is for epub2; epub3 ebooks will ignore it */
    break-after: avoid; /* Also for epub3 */
}
2. In your .xhtml:

Code:
<h2 class="noBreakAfter">Your title here</h2>

<p>Your following text here ... </p>
Of course, if you don't want to create a style, you also can write the following in your .css:

Code:
h1, h2, h3, h4, h5, h6 {
    -webkit-column-break-after: avoid;
    page-break-after: avoid;
    break-after: avoid;
}
EDIT: Which e-reader are you going to use this feature on?

Last edited by RbnJrg; 07-24-2025 at 09:32 PM.
RbnJrg is offline   Reply With Quote