Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 02-28-2021, 09:20 AM   #1
franc
Connoisseur
franc began at the beginning.
 
Posts: 68
Karma: 10
Join Date: Feb 2010
Device: none
page-break-after: always not working

Hallo

I made some experiments in an ebook's css-file (an epub) with the css property "page-break-after" and "page-break-before" like this:

Code:
...
.endofsite { 
	page-break-after: always;
	}
.beginofsite { 
	page-break-before: always;
	}
where I gave that class to a tag at the end (.endofsite) or the begin (.beginofsite) but never that makes any pagebreak in my ebook-Reader.
Tried it with calibre reader and MoonReader, neither are doing pagebreak.

Is there a way beside of creating a new html-file that my readers are doing a page break?

Thanks for hints.
frank
franc is offline   Reply With Quote
Old 02-28-2021, 06:21 PM   #2
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,312
Karma: 20171571
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
Sorry, page-break-before/after are not supported consistently. The only way I am aware of forcing it is by having a new html page.
Turtle91 is online now   Reply With Quote
Advert
Old 02-28-2021, 07:06 PM   #3
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 7,032
Karma: 91577715
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
Quote:
Originally Posted by Turtle91 View Post
Sorry, page-break-before/after are not supported consistently. The only way I am aware of forcing it is by having a new html page.
It does work in the calibre reader if coded correctly. I suspect that there is a problem with either the linking of the style sheet or calling out the class from the HTML.
jhowell is online now   Reply With Quote
Old 03-01-2021, 06:54 AM   #4
GrannyGrump
Obsessively Dedicated...
GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.
 
GrannyGrump's Avatar
 
Posts: 3,202
Karma: 34984330
Join Date: May 2011
Location: JAPAN (US expatriate)
Device: Sony PRS-T2, ADE on PC
@ franc --- this may or may not be of help -----
If you are working with epub2, you might take a look at this old thread:
https://www.mobileread.com/forums/sh...d.php?t=270007

If you have a <hr /> or an empty <div> before the "beginofsite" class, you might get spotty results. I am not sure if the same problem would arise if you have <hr /> or empty div after "endofsite".
EDIT TO ADD --- Yes, I just checked --- same problem if <hr /> or empty div comes directly after "endofsite".

As RbnJrg pointed out, I had to add a <p> with some *text* in it before the page-break-before , even if that text was only a non-breaking space. You could set font-size to .05em to make it virtually invisible. You could also play with the display: none, or visible: hidden; although I never tried those, they might work to hide that paragraph if you need it hidden.

The book in question is posted here in the library
https://www.mobileread.com/forums/sh...d.php?t=270214

Hope you can get it worked out.

Last edited by GrannyGrump; 03-01-2021 at 07:48 AM.
GrannyGrump is offline   Reply With Quote
Old 03-01-2021, 08:53 AM   #5
franc
Connoisseur
franc began at the beginning.
 
Posts: 68
Karma: 10
Join Date: Feb 2010
Device: none
Quote:
Originally Posted by Turtle91 View Post
Sorry, page-break-before/after are not supported consistently. The only way I am aware of forcing it is by having a new html page.
I guess this is the reason. It just doesn't work mostly

Quote:
Originally Posted by jhowell View Post
It does work in the calibre reader if coded correctly. I suspect that there is a problem with either the linking of the style sheet or calling out the class from the HTML.
No, doesn't work in calibre reader.
See my attached epub example. The class works, but not the page-break-after attribute.

Quote:
Originally Posted by GrannyGrump View Post
...
If you have a <hr /> or an empty <div> before the "beginofsite" class, you might get spotty results. ...
I read your thread but it doesnt work in my case.

Thank anyway!
frank
Attached Files
File Type: epub Pagebreak.epub (2.6 KB, 219 views)
franc is offline   Reply With Quote
Advert
Old 03-01-2021, 09:37 AM   #6
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 7,032
Karma: 91577715
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
Your sample works for me in the calibre viewer.
Attached Thumbnails
Click image for larger version

Name:	page1.jpg
Views:	289
Size:	15.6 KB
ID:	185694   Click image for larger version

Name:	page2.jpg
Views:	273
Size:	21.1 KB
ID:	185695  
jhowell is online now   Reply With Quote
Old 03-01-2021, 12:13 PM   #7
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 44,814
Karma: 168802811
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
What version of calibre viewer and OS are you using?
DNSB is offline   Reply With Quote
Old 03-01-2021, 01:19 PM   #8
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 7,032
Karma: 91577715
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
Make sure that the calibre viewer is not in flow mode.
Attached Thumbnails
Click image for larger version

Name:	flow-mode.jpg
Views:	235
Size:	9.0 KB
ID:	185697  
jhowell is online now   Reply With Quote
Old 03-01-2021, 02:07 PM   #9
franc
Connoisseur
franc began at the beginning.
 
Posts: 68
Karma: 10
Join Date: Feb 2010
Device: none
Quote:
Originally Posted by jhowell View Post
Make sure that the calibre viewer is not in flow mode.
AHH! Sorry, that it is. Yes, then, calibre works then too
Sorry.

Flow mode is it.
I guess the MoonReader is the same thing, there too, there is a flow mode, which I love, because I can set an exact position of reading. Not many reader can do this.

So I guess then either flow mode or (soft) page break (with css) possible.

Many thanks!

PS.: Calibre 3.48 on Mac (last working on 10.11) and the last 4.x (because of DeDRM) on Windows 10.
franc is offline   Reply With Quote
Old 03-01-2021, 03:41 PM   #10
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: 79,130
Karma: 144284184
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 franc View Post
AHH! Sorry, that it is. Yes, then, calibre works then too
Sorry.

Flow mode is it.
I guess the MoonReader is the same thing, there too, there is a flow mode, which I love, because I can set an exact position of reading. Not many reader can do this.

So I guess then either flow mode or (soft) page break (with css) possible.

Many thanks!

PS.: Calibre 3.48 on Mac (last working on 10.11) and the last 4.x (because of DeDRM) on Windows 10.
You can run Calibre 5.x on Windows 10 because DeDRM 7.1.0 is no longer a test version. But if you share databases between your MAC and Windows, then you do want to stick with 4.23 because Calibre 5 changes the database and 3.48 is not compatible. 4.23 is compatible with the version 5 database.
JSWolf is offline   Reply With Quote
Old 03-01-2021, 04:06 PM   #11
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by Turtle91 View Post
Sorry, page-break-before/after are not supported consistently. The only way I am aware of forcing it is by having a new html page.


In real life, many ereaders don't support the page-break CSS.

If the break is "mandatory" for something like a chapter break, best to do like Turtle91 recommended:

New HTML file per chapter.

Chapter01.xhtml:

Code:
<h1>Chapter 1</h1>
<p>It was a dark and stormy night.</p>
Chapter02.xhtml:

Code:
<h1>Chapter 2</h1>
<p>The next day was horrifying.</p>
That will work everywhere.

- - -

If it's "optional" (like breaking before/after a diagram or poem, etc.), then you could still keep the page-break:

Code:
<p>This is a poem:</p>

  <div class="poem">
    <p class="stanza">The cows are green.</p>
    <p class="stanza">The cows are red.</p>
    <p class="stanza">The cows are blue.</p>
  </div>
CSS:

Code:
div.poem {
  page-break-inside: avoid;
}
Those that support it, great. They'll try to display the poem as one chunk.

Those that don't support it (the vast majority)... okay. Having the CSS there won't hurt, and in the future, as support gets better, your ebook will already handle it!
Tex2002ans is offline   Reply With Quote
Old 03-01-2021, 04:33 PM   #12
franc
Connoisseur
franc began at the beginning.
 
Posts: 68
Karma: 10
Join Date: Feb 2010
Device: none
Quote:
Originally Posted by JSWolf View Post
You can run Calibre 5.x on Windows 10 because DeDRM 7.1.0 is no longer a test version. But if you share databases between your MAC and Windows, then you do want to stick with 4.23 because Calibre 5 changes the database and 3.48 is not compatible. 4.23 is compatible with the version 5 database.
Thanks! Then I can switch on PC to the v5+
I dont share databases with Mac and PC, I even dont know how that works
I use calibre only to convert books or to DeDRM books
Reading books I do only on my phone with MoonReader.
It would be great if calibre could use the same books than my phone, which I backup on Google Drive but than I would need to use Google Drive Sync on my PC and Mac too, that I dont want.

Thank you Tex2002ans too for your explanations.

frank
franc is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
page-break-after avoid not working scruffs Amazon Kindle 50 01-27-2023 06:28 AM
Do you use page-break-after and page-break-inside? fluoresce ePub 14 05-24-2017 01:57 AM
Mobi & AZW Page Break NOT working uieluck Workshop 36 11-14-2014 12:03 PM
iPad iBooks: page-break-after/inside/before NOT working? philx Apple Devices 7 01-27-2013 12:42 AM
Page break before <b> flowoeB Calibre 14 04-12-2009 03:05 PM


All times are GMT -4. The time now is 07:12 PM.


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