Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 09-15-2009, 01:39 PM   #1
lunged
Enthusiast
lunged doesn't litterlunged doesn't litter
 
Posts: 44
Karma: 122
Join Date: Mar 2009
Location: Orlando, FL
Device: iPad
How does one set the margin size?

I have tweaked some novels with Sigil since it was released, but now I want to add a nice margin to a lot of works where there is none.

I purchased an ePub from Shortcovers.com, and was pleased to see the margins didn't interfere with the page numbering! This would be a great addition to make my eBooks more aesthetically pleasing. I imagine it is done with CSS (which I know nothing about). Is there a nice WYSIWYG way doing this currently? Will a way be added?

Thanks for the help, Sigil is shaping up quickly.

EDIT: I am referring to left/right margins as well as top/bottom.
lunged is offline   Reply With Quote
Old 09-15-2009, 01:53 PM   #2
Valloric
Created Sigil, FlightCrew
Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.
 
Valloric's Avatar
 
Posts: 1,982
Karma: 350515
Join Date: Feb 2008
Device: Kobo Clara HD
Quote:
Originally Posted by lunged View Post
Is there a nice WYSIWYG way doing this currently? Will a way be added?
There is currently no WYSIWYG way of doing this. One will be added with time.
Valloric is offline   Reply With Quote
Advert
Old 09-15-2009, 02:27 PM   #3
lunged
Enthusiast
lunged doesn't litterlunged doesn't litter
 
Posts: 44
Karma: 122
Join Date: Mar 2009
Location: Orlando, FL
Device: iPad
Great, thanks!
Now, is the coding way easy enough for someone to explain in this thread, or should I just wait for the WYSIWYG method? I do know some coding, just basic HTML and Objective-C, so I should be able to catch on pretty quickly. Thanks again.
lunged is offline   Reply With Quote
Old 09-15-2009, 03:03 PM   #4
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 71,511
Karma: 306214458
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Voyage
Quote:
Originally Posted by lunged View Post
Great, thanks!
Now, is the coding way easy enough for someone to explain in this thread, or should I just wait for the WYSIWYG method? I do know some coding, just basic HTML and Objective-C, so I should be able to catch on pretty quickly. Thanks again.
Just replace your plain <body> tag with

<body style="margin:5px">

to give five pixels of margin all around the page. If you want more or less, just change the figure. If you want uneven margins, use

<body style="margin:5px 4px 0px 4px">

where the order is top, right, bottom, left.
pdurrant is offline   Reply With Quote
Old 09-17-2009, 04:24 AM   #5
ugerhard
Junior Member
ugerhard doesn't litterugerhard doesn't litter
 
Posts: 7
Karma: 110
Join Date: Aug 2009
Device: none
@page selector

Quote:
Originally Posted by pdurrant View Post
Just replace your plain <body> tag with

<body style="margin:5px">

to give five pixels of margin all around the page. If you want more or less, just change the figure. If you want uneven margins, use

<body style="margin:5px 4px 0px 4px">

where the order is top, right, bottom, left.
This will only specify the top and bottom margin for the entire document, won't it (so that the top and bottom margins for a page after the first resp. before the last page of the ebook are not set)? It will work for left and right margins, though.

To specify margins of the pages on the screen, I use the @page selector, mostly with

@page {
margin: 5pt;
}

for display on the CyBook Opus.
ugerhard is offline   Reply With Quote
Advert
Old 09-17-2009, 04:27 AM   #6
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 71,511
Karma: 306214458
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Voyage
You might be right - I don't know.

Having checked, indeed, you are right - my suggestion only affects the first and last pages of a flow for top & bottom margins.

adding your suggestion to the CSS code works

@page {
margin: 5px;
}

is the right way to do it. Thanks!


Quote:
Originally Posted by ugerhard View Post
This will only specify the top and bottom margin for the entire document, won't it (so that the top and bottom margins for a page after the first resp. before the last page of the ebook are not set)? It will work for left and right margins, though.

To specify margins of the pages on the screen, I use the @page selector, mostly with

@page {
margin: 5pt;
}

for display on the CyBook Opus.

Last edited by pdurrant; 09-17-2009 at 04:35 AM. Reason: Actually checked properly, so now I know.
pdurrant is offline   Reply With Quote
Old 09-17-2009, 05:01 AM   #7
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 71,511
Karma: 306214458
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Voyage
Thank you again for this - it's sorted out one puzzle for me to do with the cover page. Now I specify

body { margin:0; }
@page { margin: 4pt; }

in the my global CSS file, and in the cover page XHTML file I add in an override just after the link to the standard CSS like this:

<link rel="stylesheet" href="../styles/style001.css" type="text/css" />
<style type="text/css">
body {margin:0; padding: 0; border-width: 0; }
@page {margin: 0; padding: 0; border-width: 0; }
</style>

And now my cover stretches to fill the screen as much as possible. Setting padding and border-width to 0 as well as the margin might be overkill, but it does no harm as far as I know.


Quote:
Originally Posted by ugerhard View Post
To specify margins of the pages on the screen, I use the @page selector, mostly with

@page {
margin: 5pt;
}

for display on the CyBook Opus.
pdurrant is offline   Reply With Quote
Old 09-17-2009, 05:12 AM   #8
Slite
Icanhasdonuts?
Slite ought to be getting tired of karma fortunes by now.Slite ought to be getting tired of karma fortunes by now.Slite ought to be getting tired of karma fortunes by now.Slite ought to be getting tired of karma fortunes by now.Slite ought to be getting tired of karma fortunes by now.Slite ought to be getting tired of karma fortunes by now.Slite ought to be getting tired of karma fortunes by now.Slite ought to be getting tired of karma fortunes by now.Slite ought to be getting tired of karma fortunes by now.Slite ought to be getting tired of karma fortunes by now.Slite ought to be getting tired of karma fortunes by now.
 
Slite's Avatar
 
Posts: 2,837
Karma: 532407
Join Date: Aug 2008
Location: Mölnbo, Sweden
Device: Kobo Aura 2nd edition, Kobo Clara HD
Quote:
Originally Posted by pdurrant View Post
Thank you again for this - it's sorted out one puzzle for me to do with the cover page. Now I specify

body { margin:0; }
@page { margin: 4pt; }

in the my global CSS file, and in the cover page XHTML file I add in an override just after the link to the standard CSS like this:

<link rel="stylesheet" href="../styles/style001.css" type="text/css" />
<style type="text/css">
body {margin:0; padding: 0; border-width: 0; }
@page {margin: 0; padding: 0; border-width: 0; }
</style>

And now my cover stretches to fill the screen as much as possible. Setting padding and border-width to 0 as well as the margin might be overkill, but it does no harm as far as I know.
Can you use the @page { margin: 4pt; } command to set different margins for left, right, bottom and top?
Slite is offline   Reply With Quote
Old 09-17-2009, 05:40 AM   #9
ugerhard
Junior Member
ugerhard doesn't litterugerhard doesn't litter
 
Posts: 7
Karma: 110
Join Date: Aug 2009
Device: none
Quote:
Originally Posted by Slite View Post
Can you use the @page { margin: 4pt; } command to set different margins for left, right, bottom and top?
Yep, you can use margin-left, margin-right, margin-top, margin-bottom in the @page selector; the "margin: *top* *right* *bottom* *left*" syntax should work, too.
ugerhard is offline   Reply With Quote
Old 09-17-2009, 05:42 AM   #10
Slite
Icanhasdonuts?
Slite ought to be getting tired of karma fortunes by now.Slite ought to be getting tired of karma fortunes by now.Slite ought to be getting tired of karma fortunes by now.Slite ought to be getting tired of karma fortunes by now.Slite ought to be getting tired of karma fortunes by now.Slite ought to be getting tired of karma fortunes by now.Slite ought to be getting tired of karma fortunes by now.Slite ought to be getting tired of karma fortunes by now.Slite ought to be getting tired of karma fortunes by now.Slite ought to be getting tired of karma fortunes by now.Slite ought to be getting tired of karma fortunes by now.
 
Slite's Avatar
 
Posts: 2,837
Karma: 532407
Join Date: Aug 2008
Location: Mölnbo, Sweden
Device: Kobo Aura 2nd edition, Kobo Clara HD
Quote:
Originally Posted by ugerhard View Post
Yep, you can use margin-left, margin-right, margin-top, margin-bottom in the @page selector; the "margin: *top* *right* *bottom* *left*" syntax should work, too.
Cool, thanks!
Slite is offline   Reply With Quote
Old 09-17-2009, 05:45 AM   #11
ugerhard
Junior Member
ugerhard doesn't litterugerhard doesn't litter
 
Posts: 7
Karma: 110
Join Date: Aug 2009
Device: none
Quote:
Originally Posted by pdurrant View Post
Thank you again for this - it's sorted out one puzzle for me to do with the cover page.
I have not tested this, but CSS2 (which epub should implement) allows for a special selector for first pages:

@page :first { *your styles here* }

See http://www.w3.org/TR/CSS2/page.html#page-selectors:
ugerhard is offline   Reply With Quote
Old 09-17-2009, 05:46 AM   #12
Slite
Icanhasdonuts?
Slite ought to be getting tired of karma fortunes by now.Slite ought to be getting tired of karma fortunes by now.Slite ought to be getting tired of karma fortunes by now.Slite ought to be getting tired of karma fortunes by now.Slite ought to be getting tired of karma fortunes by now.Slite ought to be getting tired of karma fortunes by now.Slite ought to be getting tired of karma fortunes by now.Slite ought to be getting tired of karma fortunes by now.Slite ought to be getting tired of karma fortunes by now.Slite ought to be getting tired of karma fortunes by now.Slite ought to be getting tired of karma fortunes by now.
 
Slite's Avatar
 
Posts: 2,837
Karma: 532407
Join Date: Aug 2008
Location: Mölnbo, Sweden
Device: Kobo Aura 2nd edition, Kobo Clara HD
Quote:
Originally Posted by ugerhard View Post
I have not tested this, but CSS2 (which epub should implement) allows for a special selector for first pages:

@page :first { *your styles here* }

See http://www.w3.org/TR/CSS2/page.html#page-selectors:
Does ePub adhere to the complete CSS and/or CSS2 standard?
Slite is offline   Reply With Quote
Old 09-17-2009, 05:52 AM   #13
ugerhard
Junior Member
ugerhard doesn't litterugerhard doesn't litter
 
Posts: 7
Karma: 110
Join Date: Aug 2009
Device: none
Quote:
Originally Posted by Slite View Post
Does ePub adhere to the complete CSS and/or CSS2 standard?
Not the complete standard:

http://www.idpf.org/2007/ops/OPS_2.0_final_spec.html:
"not all CSS 2 properties are included"

but the @page :first etc. pseudo classes are supported, see

http://www.idpf.org/2007/ops/OPS_2.0...tml#Section3.3
ugerhard is offline   Reply With Quote
Old 09-17-2009, 07:30 AM   #14
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 71,511
Karma: 306214458
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Voyage
I did see that and gave it a go, but I couldn't get it to work.

If it did work, I think it would apply to the first page of each flow in the document, not the first page in the ePub - so good for doing special things at chapter starts, not so good for the cover image :-)

Quote:
Originally Posted by ugerhard View Post
I have not tested this, but CSS2 (which epub should implement) allows for a special selector for first pages:

@page :first { *your styles here* }

See http://www.w3.org/TR/CSS2/page.html#page-selectors:
pdurrant is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
set default ebook viewer window size? smee Calibre 3 10-02-2010 07:24 PM
Margin question Switch Calibre 11 05-13-2010 03:32 PM
How to shrink margin? tomsem Kindle Developer's Corner 2 12-11-2009 10:20 PM
calibre ignore margin-top and margin-bottom bender Calibre 2 12-11-2009 06:58 AM
Margin sizes... M0zza Calibre 2 09-22-2008 04:02 AM


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


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