![]() |
#1 |
Junior Member
![]() Posts: 6
Karma: 10
Join Date: May 2020
Location: Waikato, NZ
Device: kobo
|
top margin padding in Apple Books
I am new to making ebooks, but I have to do a lot, about 60, which is a backlist for a small press publisher.
This must be an old question, but the epub file I've made is formatted with large top margins - it's the style of the book, which is very short stories that begin part way down each page. Its format looks great on a kobo, or on kindle previewer, or calibre ereader, etc. With margin-top set to 180px; in the style sheet. However, when it goes into Apple Books on an ipad the top margins are gone. And there are blank pages between the short chapters where the top margins should be. Is this a familiar problem with a well-known solution? How to have top-margin padding show up on the Apple Books app? thanks. |
![]() |
![]() |
![]() |
#2 |
The Grand Mouse 高貴的老鼠
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 73,909
Karma: 315160596
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Oasis
|
Don't use px as measurements in ePubs, as its size is undefined, even though commonly 1/72nd or 1/96th of an inch.
I suspect what you're seeing in Apple Books is the top margin forcing the text onto the next page, because it's being rendered too big. A percentage might be what you need here. I suggest posting a snippet of your HTML and CSS. |
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,677
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
As for why it's not working in books (formerly iBooks), it might be that books doesn't like px in the margin. Try em and see what happens. If it still doesn't work, post the CS and the relevant HTML code so we can see how this is being coded. Last edited by JSWolf; 05-22-2020 at 04:30 AM. |
|
![]() |
![]() |
![]() |
#4 |
Junior Member
![]() Posts: 6
Karma: 10
Join Date: May 2020
Location: Waikato, NZ
Device: kobo
|
thanks for the replies.
I managed to find a solution, which is that the pages work correctly with a 'padding-top' but not a 'margin-top' setting. So I reset the margin-top to 0, put in the padding-top and they appear as I planned. It looks pretty good on an ereader (kobo), reasonably good on Apple Books, but yes, probably wouldn't work on a phone, I'll do some more testing with it. thanks again. |
![]() |
![]() |
![]() |
#5 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,677
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Junior Member
![]() Posts: 6
Karma: 10
Join Date: May 2020
Location: Waikato, NZ
Device: kobo
|
I tried all the top-margin-padding settings with 4em, it does look better.
The title pages actually start further down the page than when set at 180px! As the font is large, but the other pages start up nearer the top, together they work well. |
![]() |
![]() |
![]() |
#7 |
The Grand Mouse 高貴的老鼠
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 73,909
Karma: 315160596
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Oasis
|
It is not usually a good idea to use em for the top margin. Unless you really want the space at the top to be proportional to the font size the reader chooses.
|
![]() |
![]() |
![]() |
#8 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,546
Karma: 19001583
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
... and an absolute unit is not good, because you don't know the screen size it will be read in.
... and a % is not good, because a % in top/bottom margin is actually relative to the element's (usually the screen's) width, not height, so the margin will be larger in landscape than in portrait orientation! |
![]() |
![]() |
![]() |
#9 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,677
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
I use a small em for the top margin of the chapter header. I find it works better. Also, if the text size was needed to be increase, the top margin would not be too large.
I use 0.8em as my small top margin though 1em works as well. |
![]() |
![]() |
![]() |
#10 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,677
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
![]() |
![]() |
![]() |
#11 | |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,546
Karma: 19001583
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
'margin-top', 'margin-bottom' [...] Percentages: refer to width of containing block |
|
![]() |
![]() |
![]() |
#12 |
The Grand Mouse 高貴的老鼠
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 73,909
Karma: 315160596
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Oasis
|
Goodness me. I never knew that. But it seems that you can set the top margin to a percentage in a page context, and it'll be on the page height, not width. That might be an option, but I don't know how to do it for a single page.
|
![]() |
![]() |
![]() |
#13 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,062
Karma: 91577715
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
|
The "vh" unit (percent of viewport height) would be good to use for this case. Too bad it is not universally supported.
|
![]() |
![]() |
![]() |
#14 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,546
Karma: 19001583
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
There seems to be an exception for @page, but that's CSS3, and ePub 2 is CSS 2.1, as far as I remember (https://www.w3.org/TR/css-page-3/#page-properties):
The normal rules for CSS properties apply with the following exceptions: [...] Percentage values on the margin and padding properties are relative to the dimensions of the containing block. For right and left values, percentages are relative to the width of the containing block; for top and bottom values, percentages are relative to the height of the containing block. |
![]() |
![]() |
![]() |
#15 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,677
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Troubleshooting Odd text appearing on top margin of Kindle books (both on iPad and Voyage) | solitarywolf | Amazon Kindle | 7 | 07-14-2016 01:54 PM |
CSS: Margin vs. Padding | ButWhy | Workshop | 6 | 07-31-2015 12:55 PM |
Top-margin (bottom-margin?) for Kobo? | Notjohn | Sigil | 14 | 02-28-2015 06:43 AM |
CSS margin instead of margin-top, etc. | icallaci | Conversion | 24 | 10-19-2013 09:52 AM |
calibre ignore margin-top and margin-bottom | bender | Calibre | 2 | 12-11-2009 06:58 AM |