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 05-06-2010, 05:51 PM   #1
penguintri
Member
penguintri began at the beginning.
 
Posts: 14
Karma: 10
Join Date: Apr 2010
Device: PRS-300
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.
penguintri is offline   Reply With Quote
Old 05-06-2010, 06:31 PM   #2
DaleDe
Grand Sorcerer
DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.
 
DaleDe's Avatar
 
Posts: 9,795
Karma: 5137308
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2
em requires a font and no font is defined in @page time. You need other units like pixels, or points.
DaleDe is offline   Reply With Quote
Old 05-06-2010, 06:48 PM   #3
penguintri
Member
penguintri began at the beginning.
 
Posts: 14
Karma: 10
Join Date: Apr 2010
Device: PRS-300
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.
penguintri is offline   Reply With Quote
Old 05-07-2010, 07:27 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: 6,325
Karma: 4964183
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.
Jellby is offline   Reply With Quote
Old 05-08-2010, 09:51 AM   #5
HarryT
eBook Enthusiast
HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.
 
HarryT's Avatar
 
Posts: 65,640
Karma: 44618293
Join Date: Nov 2006
Location: UK
Device: Kindle Voyage, iPad Mini, iPhone 4, MS Surface Pro, N7
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?
HarryT is offline   Reply With Quote
Old 05-08-2010, 01:32 PM   #6
penguintri
Member
penguintri began at the beginning.
 
Posts: 14
Karma: 10
Join Date: Apr 2010
Device: PRS-300
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
    }
I didn't realise that em scaled with the font size. I just used it as this is the way calibre default set my margins. What would an approximate equivalent to 0.28em in pt be?
penguintri is offline   Reply With Quote
Old 05-08-2010, 03:18 PM   #7
DaleDe
Grand Sorcerer
DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.
 
DaleDe's Avatar
 
Posts: 9,795
Karma: 5137308
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2
Quote:
Originally Posted by penguintri View Post
I didn't realise that em scaled with the font size. I just used it as this is the way calibre default set my margins. What would an approximate equivalent to 0.28em in pt be?
How can we know? An em is the width of the letter M in whatever point size that the letter M is in while a point size is 1/72 of an inch.

Dale
DaleDe is offline   Reply With Quote
Old 05-08-2010, 03:47 PM   #8
HarryT
eBook Enthusiast
HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.
 
HarryT's Avatar
 
Posts: 65,640
Karma: 44618293
Join Date: Nov 2006
Location: UK
Device: Kindle Voyage, iPad Mini, iPhone 4, MS Surface Pro, N7
Quote:
Originally Posted by penguintri View Post
I didn't realise that em scaled with the font size. I just used it as this is the way calibre default set my margins. What would an approximate equivalent to 0.28em in pt be?
Yes, that's the whole point of "em" units - the fact that they scale with the font. You use them in situations where you want something to "match up" with the font size. Eg, for indenting poetry, I use 1em for each "level" of indentation, because that's something that you want to change with the font size. As Dale notes, 1em is the width of a letter "M" in the current font.

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%.
HarryT is offline   Reply With Quote
Old 05-08-2010, 09:37 PM   #9
charleski
Wizard
charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.
 
Posts: 1,188
Karma: 727236
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>
Once this has gone, then you can control the top and bottom margins from the @page rule in the css file.

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.
charleski 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
larger top page margin when printing to pdf? whbenson Sigil 0 05-15-2010 01:38 AM
little issue converting from odt to epub (top and bottom margin) superanima Calibre 1 02-15-2010 05:15 PM
ePub and top margin specification tompe Upload Help 6 01-02-2010 12:24 PM
calibre ignore margin-top and margin-bottom bender Calibre 2 12-11-2009 07:58 AM
EPUB Margin Adjustment jbjb Calibre 2 11-06-2009 06:37 AM


All times are GMT -4. The time now is 08:21 PM.


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