05-06-2010, 04:51 PM | #1 |
Enthusiast
Posts: 29
Karma: 10
Join Date: Apr 2010
Device: Paperwhite 2
|
Top Margin in epub
I'm having trouble setting the margin at the top of my screen on an epub. The text is to close to the edge and can have a shadow over it. ( I'm using a prs 300 btw).
I have tried putting in a @page { margin-top: 2.5em; margin-bottom: 1em } and changing different calibre styles but I can't seem to manage to change the top margin. Cheers for any help. |
05-06-2010, 05:31 PM | #2 |
Grand Sorcerer
Posts: 11,470
Karma: 13095790
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2 & Air 2, iPhone 7
|
em requires a font and no font is defined in @page time. You need other units like pixels, or points.
|
Advert | |
|
05-06-2010, 05:48 PM | #3 |
Enthusiast
Posts: 29
Karma: 10
Join Date: Apr 2010
Device: Paperwhite 2
|
Ah cheers.
I tried using @page { margin-top: 12pt; margin-bottom: 12pt } and it didn't work! I'm not sure if I'm using it right, I'm just inserting it at the top of the css after the @namespace h "http://www.w3.org/1999/xhtml"; that is in the css. |
05-07-2010, 06:27 AM | #4 |
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Make sure the css file is actually being used in the book, and that there is no other @page rule overriding your settings.
|
05-08-2010, 08:51 AM | #5 |
eBook Enthusiast
Posts: 85,544
Karma: 93383043
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
|
Why do you want to define your page margins in "em" units. Do you honestly want your margins to be bigger if the user increases the font size?
|
Advert | |
|
05-08-2010, 12:32 PM | #6 |
Enthusiast
Posts: 29
Karma: 10
Join Date: Apr 2010
Device: Paperwhite 2
|
How would I make sure the book is using the css for the top margin? This is the css I have for my book.
Code:
@namespace h "http://www.w3.org/1999/xhtml"; @page { margin-top: 22pt; margin-bottom: 1pt } .calibre { widows: 1; orphans: 1; display: block; font-size: 1em; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; page-break-before: always } .calibre1 { border-bottom: 0; border-top: 0; display: block; margin-bottom: 0; margin-top: 0; padding-bottom: 0; padding-top: 0; text-indent: 1.5em } .calibre2 { display: block; font-size: 1.6em; font-weight: bold; margin-bottom: 0.67em; margin-left: 0; margin-right: 0; margin-top: 0.67em } .calibre3 { display: block; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding-bottom: 0; padding-left: 0; padding-right: 0; padding-top: 0; page-break-before: always } .calibre4 { border-bottom: 0; border-top: 0; display: block; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding-bottom: 0; padding-top: 0; text-align: justify; text-indent: 1em } .calibre5 { display: block; font-size: 1.6em; font-weight: bold; margin-bottom: 0.67em; margin-left: 0; margin-right: 0; margin-top: 0.67em; text-align: center } .calibre6 { widows: 1; orphans: 1; font-size: 1.25em; border: 0; border-bottom: 0; border-top: 0; display: block; margin-bottom: 0; margin-left: 0.28em; margin-right: 0.28em; margin-top: 0.01em; padding-bottom: 0; padding-left: 0; padding-right: 0; padding-top: 0; text-align: justify; text-indent: 1em } .calibre7 { display: block; font-size: 1.5em; font-weight: bold; margin-bottom: 0.83em; margin-left: 0; margin-right: 0; margin-top: 0.83em; text-align: center } .calibre8 { border-bottom: 0; border-top: 0; display: block; margin-bottom: 0; margin-left: 1em; margin-right: 1em; margin-top: 0; padding-bottom: 0; padding-top: 0; page-break-after: always; text-align: justify; text-indent: 1.5em } .calibre9 { border-bottom: 0; border-top: 0; display: block; margin-bottom: 0; margin-top: 0; padding-bottom: 0; padding-top: 0; page-break-after: always; text-indent: 1.5em } a { color: inherit; text-decoration: inherit; cursor: default } a[href] { color: blue; text-decoration: underline; cursor: pointer } |
05-08-2010, 02:18 PM | #7 | |
Grand Sorcerer
Posts: 11,470
Karma: 13095790
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2 & Air 2, iPhone 7
|
Quote:
Dale |
|
05-08-2010, 02:47 PM | #8 | |
eBook Enthusiast
Posts: 85,544
Karma: 93383043
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
|
Quote:
For something like page margins, though, you probably want to either use a fixed physical width, such as 10pt, or you want to make them a percentage of the page size, eg 5%. |
|
05-08-2010, 08:37 PM | #9 |
Wizard
Posts: 1,196
Karma: 1281258
Join Date: Sep 2009
Device: PRS-505
|
Ah, the real problem here is one of calibre's slightly annoying quirks.
Calibre places an @page rule in the header of each html file, and this overrides any @page rule in the css. The solution is to edit all your html files and remove the style that calibre has inserted at the top. It will look like this: Code:
<style type="text/css"> @page { margin-bottom: 5.000000pt; margin-top: 5.000000pt; }</style> Be aware that ADE seems to add a small top margin of its own (even with no top margin, there is still a small gap at the top) - this is on the PRS-505, other implementations may differ. I find a top margin of 9pt works well, and visually matches the 12pt right and left margins I use. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
larger top page margin when printing to pdf? | whbenson | Sigil | 0 | 05-15-2010 12:38 AM |
little issue converting from odt to epub (top and bottom margin) | superanima | Calibre | 1 | 02-15-2010 04:15 PM |
ePub and top margin specification | tompe | Upload Help | 6 | 01-02-2010 11:24 AM |
calibre ignore margin-top and margin-bottom | bender | Calibre | 2 | 12-11-2009 06:58 AM |
EPUB Margin Adjustment | jbjb | Calibre | 2 | 11-06-2009 05:37 AM |