Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
Old 09-12-2014, 06:10 AM   #1
Arkadian
Connoisseur
Arkadian began at the beginning.
 
Posts: 96
Karma: 10
Join Date: Mar 2014
Device: none
Box divided between two pages

I have defined a text box like this:

Code:
<style> 
div.box1 {
  width: 20em;  
    background-color:#D1D3D4;
	border-bottom: 3px double;
	border-top: 3px double;
	border-left: 3px double;
	border-right: 3px double;
	padding: 1em;
  margin-top: 1em;
	line-height: 1.7em;
	text-align: center;
    float: right;
}
</style>


  <div class="box1">Yadda, yadda, yadda, yadda, yadda, yadda.</div>
  <div style="clear:both;"></div>
which works fine and looks pretty. Is there a way to stop the box from being divided between two pages if it happens to be at the end of a page?

In the editor it always looks fine, but then when I look at the book on my iPad using iBooks, that's when I see the problem.
Arkadian is offline   Reply With Quote
Old 09-12-2014, 07:08 AM   #2
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
You could add 'page-break-inside: avoid' to the div class. No guarantee though, it is not supported on all devices. It probably is in iBooks.
Toxaris is offline   Reply With Quote
Advert
Old 09-12-2014, 09:02 AM   #3
Arkadian
Connoisseur
Arkadian began at the beginning.
 
Posts: 96
Karma: 10
Join Date: Mar 2014
Device: none
thanks... will give that a shot
Arkadian is offline   Reply With Quote
Old 09-12-2014, 12:14 PM   #4
Arkadian
Connoisseur
Arkadian began at the beginning.
 
Posts: 96
Karma: 10
Join Date: Mar 2014
Device: none
OK, sorry for the daft question (and yes, I know I should be ashamed of myself...), how do I actually add that string to the "div class"?
Arkadian is offline   Reply With Quote
Old 09-12-2014, 12:24 PM   #5
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
Err, in the stylesheet of course. You already gave a style definition for the div (box1). Just add it to it.
Toxaris is offline   Reply With Quote
Advert
Old 09-12-2014, 12:59 PM   #6
Arkadian
Connoisseur
Arkadian began at the beginning.
 
Posts: 96
Karma: 10
Join Date: Mar 2014
Device: none
This is what (I think) I have done...
I have now this:
Code:
<div class="box1" page-break-inside: avoid>
but then when I open the book I get this:


Quote:
“This page contains the following errors:
error on line 44 at column 36: Specification mandate value for attribute avoid
Below is a rendering of the page up to the first error.”
Arkadian is offline   Reply With Quote
Old 09-12-2014, 01:28 PM   #7
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,067
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by Arkadian View Post
This is what (I think) I have done...
I have now this:
Code:
<div class="box1" page-break-inside: avoid>
but then when I open the book I get this:
Put that IN the stylesheets .box1 , not the div tag
theducks is offline   Reply With Quote
Old 09-12-2014, 01:33 PM   #8
Arkadian
Connoisseur
Arkadian began at the beginning.
 
Posts: 96
Karma: 10
Join Date: Mar 2014
Device: none
Erm... it is not in the stylesheet... It is all in there, in the file itself.

(Please, no swearing at the screen ... )

Last edited by Arkadian; 09-12-2014 at 02:06 PM.
Arkadian is offline   Reply With Quote
Old 09-12-2014, 03:26 PM   #9
mrmikel
Color me gone
mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.
 
Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
between the style tags at the top of document.
mrmikel is offline   Reply With Quote
Old 09-12-2014, 03:37 PM   #10
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,067
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by mrmikel View Post
between the style tags at the top of document.


That is still a form stylesheet, just not separate
theducks is offline   Reply With Quote
Old 09-12-2014, 03:47 PM   #11
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
Don't take this wrong, but perhaps a crash course HTML/CSS would be a good idea for the general ideas...

To spell it out:
Code:
<style> 
div.box1 {
  width: 20em;  
    background-color:#D1D3D4;
	border-bottom: 3px double;
	border-top: 3px double;
	border-left: 3px double;
	border-right: 3px double;
	padding: 1em;
  margin-top: 1em;
	line-height: 1.7em;
	text-align: center;
    float: right;
    page-break-inside: avoid;
}
</style>


  <div class="box1">Yadda, yadda, yadda, yadda, yadda, yadda.</div>
  <div style="clear:both;"></div>
Toxaris is offline   Reply With Quote
Old 09-12-2014, 04:03 PM   #12
Arkadian
Connoisseur
Arkadian began at the beginning.
 
Posts: 96
Karma: 10
Join Date: Mar 2014
Device: none
Ok, assuming there was a need to stress it further, I am a TOTAL dope The box thing now seems to be working fine and thanks to all that have put up with me.
I have tried one chapter only, but I am hopeful now
Arkadian is offline   Reply With Quote
Old 09-12-2014, 04:17 PM   #13
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,067
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by Arkadian View Post
Ok, assuming there was a need to stress it further, I am a TOTAL dope The box thing now seems to be working fine and thanks to all that have put up with me.
I have tried one chapter only, but I am hopeful now
A classic case of why to use a separate Stylesheet (used for all chapters)

fix it once in the sheet, check for exceptions , Done
theducks is offline   Reply With Quote
Old 09-12-2014, 05:01 PM   #14
Arkadian
Connoisseur
Arkadian began at the beginning.
 
Posts: 96
Karma: 10
Join Date: Mar 2014
Device: none
Indeed so...
Arkadian is offline   Reply With Quote
Old 09-12-2014, 09:17 PM   #15
mrmikel
Color me gone
mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.
 
Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
Not hard to do either. Copy all the stuff between the style tags. Paste it into notepad or something similar and save it as yourchoiceoffilename.css.

Then use calibre or sigil to open the document. Eliminate the same stuff, including the style tags this time in each section. Then import your new css file and the last step is linking each file to this spreadsheet. It is easy to do this all at once by selecting all the sections.

You can also export a stylesheet and save it then you can use it over again. When you alter it with new stuff, save it again so you can use all your new updates in your next project.

You might not want to link the very first file in your epub to this overall stylesheet. It is often a titlepage where you might want each line to be spaced much wider from its predecessor. You can save this special stylesheet separate and reuse it in your following ones. That way once you have solved a problem, you can bring your solution very easily into your latest effort.

In any case, when you used a linked stylesheet, a change in this main stylesheet corrects all, so all captions look the same, all pictures are handled the same etc, as the ducks noted.
mrmikel is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
A Mother's Sacrifice for Racially Divided Children TwoKindsofColor Self-Promotions by Authors and Publishers 32 06-30-2012 12:24 PM
PDF pages in a box Mamaijee Calibre 4 01-10-2011 10:37 PM
The Divided Man, a Novel of the Ghost Dance JohnSauer Self-Promotions by Authors and Publishers 2 12-20-2010 09:23 AM
Historical Fiction Henty, George Alfred: Friends, though divided. V1. 2 May 2010 crutledge ePub Books 0 05-02-2010 12:16 PM
Publishers 'completely divided' over e-book pricing DMcCunney News 71 10-17-2009 05:48 PM


All times are GMT -4. The time now is 07:45 AM.


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