Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old Yesterday, 04:24 AM   #1
icearch
Connoisseur
icearch began at the beginning.
 
Posts: 55
Karma: 10
Join Date: Nov 2025
Device: none
About page-break

page-break-after
page-break-before
page-break-inside

How well are they supported in epub3 and 2 now? I have used them in some case but they tend to fail.

The only certain way I know to let content start in a new page is creating a new xhtml file. But some web novel can have 1000 chapters, it's tedious to have 1000 xhtml files.

So how well are they work exactly now? How can I guarantee a page break?
icearch is offline   Reply With Quote
Old Yesterday, 05:37 AM   #2
Karellen
Wizard
Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.
 
Karellen's Avatar
 
Posts: 1,744
Karma: 9501034
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
Those tags are deprecate:
https://developer.mozilla.org/en-US/...e-break-inside

Should use:
https://developer.mozilla.org/en-US/...s/break-inside

Though the Libra2 does not recognise the newer tag and still prefers the deprecated tag.

Use both tags in your CSS. Something like this...
.nopagebreak {
break-inside: avoid;
page-break-inside: avoid;
}
Karellen is online now   Reply With Quote
Old Yesterday, 06:18 AM   #3
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 81,565
Karma: 150265991
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by icearch View Post
page-break-after
page-break-before
page-break-inside

How well are they supported in epub3 and 2 now? I have used them in some case but they tend to fail.

The only certain way I know to let content start in a new page is creating a new xhtml file. But some web novel can have 1000 chapters, it's tedious to have 1000 xhtml files.

So how well are they work exactly now? How can I guarantee a page break?
Instead of doing a page break before or after, just split the HTML where you want the page break. That way the page break will 100% work.
JSWolf is offline   Reply With Quote
Old Yesterday, 06:40 AM   #4
icearch
Connoisseur
icearch began at the beginning.
 
Posts: 55
Karma: 10
Join Date: Nov 2025
Device: none
The tutorial I see is so old...
I'm going to try break before and after later. Thank you.
icearch is offline   Reply With Quote
Old Yesterday, 06:41 AM   #5
icearch
Connoisseur
icearch began at the beginning.
 
Posts: 55
Karma: 10
Join Date: Nov 2025
Device: none
Quote:
Originally Posted by JSWolf View Post
Instead of doing a page break before or after, just split the HTML where you want the page break. That way the page break will 100% work.
Bro, do you read other's post or not?
icearch is offline   Reply With Quote
Old Yesterday, 08:42 AM   #6
icearch
Connoisseur
icearch began at the beginning.
 
Posts: 55
Karma: 10
Join Date: Nov 2025
Device: none
Quote:
Originally Posted by Karellen View Post
Those tags are deprecate:
https://developer.mozilla.org/en-US/...e-break-inside

Should use:
https://developer.mozilla.org/en-US/...s/break-inside

Though the Libra2 does not recognise the newer tag and still prefers the deprecated tag.

Use both tags in your CSS. Something like this...
.nopagebreak {
break-inside: avoid;
page-break-inside: avoid;
}
Sadly, break-before: always; and break-before: page; does absolute nothing.
At least in Sigil's readium plugin.
Does this have something to do with the plugin? Or it will happen in other readers out there?
icearch is offline   Reply With Quote
Old Yesterday, 08:55 AM   #7
icearch
Connoisseur
icearch began at the beginning.
 
Posts: 55
Karma: 10
Join Date: Nov 2025
Device: none
And more test, yes, lot's of reader software does not work. Some do though.
Why it is so hard to put such basic and simple function to work?
icearch is offline   Reply With Quote
Old Yesterday, 12:13 PM   #8
j.p.s
Grand Sorcerer
j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.
 
Posts: 5,891
Karma: 106187745
Join Date: Apr 2011
Device: pb360
Quote:
Originally Posted by JSWolf View Post
Instead of doing a page break before or after, just split the HTML where you want the page break. That way the page break will 100% work.
Quote:
Originally Posted by icearch View Post
Bro, do you read other's post or not?
Very long history of not, despite numerous complaints from numerous people..
j.p.s is offline   Reply With Quote
Old Yesterday, 01:42 PM   #9
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,899
Karma: 8939999
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by icearch View Post
page-break-after
page-break-before
page-break-inside

How well are they supported in epub3 and 2 now? I have used them in some case but they tend to fail.

The only certain way I know to let content start in a new page is creating a new xhtml file. But some web novel can have 1000 chapters, it's tedious to have 1000 xhtml files.

So how well are they work exactly now? How can I guarantee a page break?
You should use:

Code:
page-break-after: always|avoid; /* This is for epub2 (ADE RMSDK) */
break-after: always|avoid; /* This is for epub3 */
-webkit-column-break-after: always|avoid; /* This is for epub3, for ereaders that use webkit rendering engine */
The same for break-before and break-inside. So, if for example you want to avoid a break after a h* tag, then you should use the following style:

Code:
.break_avoid {
   page-break-after: avoid; /* This is ignored by epub3 */
   break-after: avoid; /* This is ignored by epub2 */
   -webkit-column-break-after: avoid; /* This is ignored by epub2 */
}
and

Code:
   <h2 class="break_avoid">This is a Title</h2>

   <p>Blah, blah, blah... (a long paragraph)</p>
Try this code in Calibre, Thorium, ADE, Sigil's plugins (Readium, BibiReader, JSReader), KOReader, Kobo for Android, Lithium, Reasily, PocketBook, Cantook, Infinity Reader. BookFusion.

If you don't want to use -webkit-column-break-after: avoid, then use:

Code:
   break-after: avoid-column
but your style must have one of them. Of that way, an alternative style would be:

Code:
.break_avoid {
   page-break-after: avoid; /* This is ignored by epub3 */
   break-after: avoid; /* This is ignored by epub2 */
   break-after: avoid-column; /* This is ignored by epub2 */
}
RbnJrg is offline   Reply With Quote
Old Yesterday, 07:22 PM   #10
icearch
Connoisseur
icearch began at the beginning.
 
Posts: 55
Karma: 10
Join Date: Nov 2025
Device: none
Quote:
Originally Posted by RbnJrg View Post
You should use:

Code:
page-break-after: always|avoid; /* This is for epub2 (ADE RMSDK) */
break-after: always|avoid; /* This is for epub3 */
-webkit-column-break-after: always|avoid; /* This is for epub3, for ereaders that use webkit rendering engine */
You are absolutely right. Last night I asked one of my programmer friend. He found out that Readium core does not devied page in the supposed way, they use multi column to do page cut.

Like, who in the hell would thought of that?

Our final solution are just like yours, but add !important after each value, so it can have higher priority.

Thank you very much for your detailed explanation!
icearch is offline   Reply With Quote
Old Yesterday, 07:36 PM   #11
icearch
Connoisseur
icearch began at the beginning.
 
Posts: 55
Karma: 10
Join Date: Nov 2025
Device: none
By the way, the reader plugins in Sigil are pretty old, like the last update is in 2023, and the whole readium homepage in Github just vanished?

Is there any new / better reader plugin or whole other new ways to verify the file I'm making on the fly?
icearch is offline   Reply With Quote
Old Yesterday, 09:33 PM   #12
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,899
Karma: 8939999
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by icearch View Post
By the way, the reader plugins in Sigil are pretty old, like the last update is in 2023, and the whole readium homepage in Github just vanished?

Is there any new / better reader plugin or whole other new ways to verify the file I'm making on the fly?
Test your epubs with the Sigil's plugin if you wish (I do it), don't worry about they are "old"
RbnJrg is offline   Reply With Quote
Old Yesterday, 09:43 PM   #13
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,899
Karma: 8939999
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by icearch View Post
You are absolutely right. Last night I asked one of my programmer friend. He found out that Readium core does not devied page in the supposed way, they use multi column to do page cut.
Yes, indeed. And for that reason you need to have in the style:

Code:
   
   break-after: avoid;
   -webkit-column-break-after: avoid; /* This is for ereaders that employ multicolumn to display pages */
or

Code:
   
   break-after: avoid;
   break-after: avoid-column; /* This is for ereaders that employ multi-column to display pages */
In my tests, practically all epub3 ereaders display pages in multi-column mode; for that reason the property "break-after: avoid;" doesn't work there (you need "break-after: avoid-column;" or the webkit's alternative).

Quote:
Like, who in the hell would thought of that?
It's quite common nowadays

Quote:
Our final solution are just like yours, but add !important after each value, so it can have higher priority.
Ok, no problem with that.

Quote:
Thank you very much for your detailed explanation!
You are welcome
RbnJrg is offline   Reply With Quote
Old Today, 07:53 AM   #14
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,439
Karma: 20456789
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
The only addition I would make is if you are trying to force/avoid a break after every xxxx element, then just add the code to that element’s css rather than adding a class to all of them. That cleans up your html a bit.

Of course, you could keep the code as its own class as well for those one-off elements that might need it.
Turtle91 is offline   Reply With Quote
Old Today, 11:05 AM   #15
icearch
Connoisseur
icearch began at the beginning.
 
Posts: 55
Karma: 10
Join Date: Nov 2025
Device: none
Quote:
Originally Posted by Turtle91 View Post
The only addition I would make is if you are trying to force/avoid a break after every xxxx element, then just add the code to that element’s css rather than adding a class to all of them. That cleans up your html a bit.

Of course, you could keep the code as its own class as well for those one-off elements that might need it.
I think class really doesn't take that much space, so no harm to use when needed. If I want to not use this feature, there would just be more hassle I think.

In fact, just to my own preference, even most p in my book needs 2em indent, I still use class to let them indent, just because i need some p to be not affected.
icearch is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
page-break-before: always; avresbo Kobo Reader 1 03-02-2023 09:30 AM
Do you use page-break-after and page-break-inside? fluoresce ePub 14 05-24-2017 02:57 AM
No page break for H2 RickAltman Calibre 2 06-25-2012 12:02 PM
PAGE BREAK JFS-NMF Recipes 0 03-04-2011 10:15 AM
Page break before <b> flowoeB Calibre 14 04-12-2009 04:05 PM


All times are GMT -4. The time now is 02:58 PM.


MobileRead.com is a privately owned, operated and funded community.