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

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 10-15-2013, 06:05 AM   #1
canpolat
Connoisseur
canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.
 
Posts: 92
Karma: 17950
Join Date: Mar 2013
Device: Xodo
Question margin-top with page-break-before

I'm working on an ePub. it has many (very) short stories in it, so, I gather 5-10 of them in a single html file. Then I use page-break-before:always to make every story start in a new page.

Code:
{
h1 {page-break-before:always}
}
This works quite OK.

I also want to have some space before the headings. But when I add a margin-top property to h1, it doesn't seem to take effect. The heading starts at the very beginning of the page no matter how big a margin I set in the CSS.

I suppose I'm missing something. Any ideas?
canpolat is offline   Reply With Quote
Old 10-15-2013, 06:16 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 are not missing anything. The specifications allow readers to ignore margin-top after a page-break-before/after.
You are better of placing each story in a separate HTML file. Easier to maintain as well in my opinion.
Toxaris is offline   Reply With Quote
Advert
Old 10-15-2013, 06:25 AM   #3
canpolat
Connoisseur
canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.
 
Posts: 92
Karma: 17950
Join Date: Mar 2013
Device: Xodo
Quote:
Originally Posted by Toxaris View Post
You are not missing anything. The specifications allow readers to ignore margin-top after a page-break-before/after.
You are better of placing each story in a separate HTML file. Easier to maintain as well in my opinion.
Thank you for the response Toxaris. I suspected that, but couldn't find it. Breaking the files to small HTML files may result in hundreds of HTML files and it may be intimidating for some of the tools (I remember Sigil taking very long time when saving the smallest of a change with such an ePub).

I don't have my tools installed on this PC so I cannot try this, but here is another idea. What if I add another tag in front of the h1 tags?

Code:
<hr class="page-break">
<h1>My Title</h1>
with

Code:
.page-break {
visibility:hidden;
page-break-before:always
}

Last edited by canpolat; 10-15-2013 at 06:37 AM.
canpolat is offline   Reply With Quote
Old 10-15-2013, 08:01 AM   #4
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,514
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by canpolat View Post
Code:
.page-break {
visibility:hidden;
page-break-before:always
}
"visibility" is not a required property in the ePub spec. I use simply an empty <div>:

Code:
<div class="pagebreak" />
<h1>My Title</h1>
Code:
div.pagebreak {
  height: 0;
  margin: 0;
  padding: 0;
  page-break-before: always;
}
(or <div class="pagebreak">&nbsp;</div> if the reader doesn't like empty elements).

Another solution is using padding instead of margin for the <h1> (if you don't have background or borders): unlike margin, padding is not discarded after a forced pagebreak.
Jellby is offline   Reply With Quote
Old 10-15-2013, 08:53 AM   #5
canpolat
Connoisseur
canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.
 
Posts: 92
Karma: 17950
Join Date: Mar 2013
Device: Xodo
Quote:
Originally Posted by Jellby View Post
Another solution is using padding instead of margin for the <h1> (if you don't have background or borders): unlike margin, padding is not discarded after a forced pagebreak.
I actually tried using "padding", and at least ADE discarded it (I didn't try with any other reader since it's the de facto standard). But I will try the solution with "div". Thanks

Last edited by canpolat; 10-15-2013 at 09:05 AM.
canpolat is offline   Reply With Quote
Advert
Old 10-15-2013, 01:36 PM   #6
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,514
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by canpolat View Post
I actually tried using "padding", and at least ADE discarded it
Hmm... I should have written "should not be discarded". But anyway, I think I tried padding at some point and it worked, are you sure you don't have some other error in the CSS?
Jellby is offline   Reply With Quote
Old 10-15-2013, 02:35 PM   #7
canpolat
Connoisseur
canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.
 
Posts: 92
Karma: 17950
Join Date: Mar 2013
Device: Xodo
Quote:
Originally Posted by Jellby View Post
Hmm... I should have written "should not be discarded". But anyway, I think I tried padding at some point and it worked, are you sure you don't have some other error in the CSS?
Now I did a quick test with a CSS that only contains the following lines:

Code:
h1{
  page-break-before:always;
  padding-top: 5em;
}
And ADE happily obeyed the padding Perhaps there is something else in the other CSS file. Thank you for the suggestions!
canpolat is offline   Reply With Quote
Old 10-16-2013, 04:29 AM   #8
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
BTW, the latest versions of Sigil can handle multiple files easily. Hundreds of files is not an issue.
Toxaris is offline   Reply With Quote
Old 10-16-2013, 12:01 PM   #9
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: 29,689
Karma: 54369090
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Just remember.
Sigil WILL flatten any folder structure. All file NAMES must be unique as the path is not considered part of the name. All duplicate name will get overwritten.
theducks is offline   Reply With Quote
Old 10-16-2013, 01:02 PM   #10
canpolat
Connoisseur
canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.canpolat for a long time would go to bed early.
 
Posts: 92
Karma: 17950
Join Date: Mar 2013
Device: Xodo
@Toxaris, @theducks: Thanks for sharing that info. Since padding seems to work, I think I'll stick to that. It eases the process for me.

Quote:
Sigil WILL flatten any folder structure. All file NAMES must be unique as the path is not considered part of the name. All duplicate name will get overwritten.
Is this according to the ePub standard, or just the way Sigil handles things?
canpolat is offline   Reply With Quote
Old 10-16-2013, 01:17 PM   #11
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: 29,689
Karma: 54369090
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 canpolat View Post
@Toxaris, @theducks: Thanks for sharing that info. Since padding seems to work, I think I'll stick to that. It eases the process for me.


Is this according to the ePub standard, or just the way Sigil handles things?
Just the way Sigil does it for EPUB2.

Puts each TYPE of file into folders:
Fonts (TTF,OTF)
Text (HTML,XHTML)
Styles (CSS)
Images (GIF, JPEG,PNG)

there are a few other folders in later versions for EPUB3/unknown files
theducks 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
CSS margin instead of margin-top, etc. icallaci Conversion 24 10-19-2013 09:52 AM
@page { margin-bottom: 5.000000pt; margin-top: 5.000000pt; } cybmole Conversion 15 02-12-2011 11:57 AM
larger top page margin when printing to pdf? whbenson Sigil 0 05-15-2010 12:38 AM
Top Margin in epub penguintri ePub 8 05-08-2010 08:37 PM
calibre ignore margin-top and margin-bottom bender Calibre 2 12-11-2009 06:58 AM


All times are GMT -4. The time now is 10:39 AM.


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