![]() |
#1 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,720
Karma: 1759970
Join Date: Sep 2010
Device: none
|
@page { margin-bottom: 5.000000pt; margin-top: 5.000000pt; }
most - maybe all of my ebook conversions contain this line, before the html body
@page { margin-bottom: 5.000000pt; margin-top: 5.000000pt; } is it put there by calibre ? does it do what I think it does - i.e. force a top & bottom margin- if so can I override it with the extra CSS option rather than edit each books contents, so that I have no wasted white space at top / bottom when converted for Kindle ?, or is there a better way to countermand it please ? PS - google found me this, in an old thread- does calibre still have no override or workaround ? "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: <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." PPS I read elsewhere that Kindle ignores or does not support bottom margin - it that's true , then this becomes a question only about controlling top margin, also ( running out of PPPS's here ) googling "@page rule" suggests that it only applies to printed paginated media, so what is the code for in an .epub ?, and is messing with it a pointless exercise for books destined for e-readers? Last edited by cybmole; 02-10-2011 at 03:54 PM. |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,144
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
It's there for those epub readers that support top and bottom margins and you can control it via the page setup options under conversion settings.
|
![]() |
![]() |
![]() |
#3 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,720
Karma: 1759970
Join Date: Sep 2010
Device: none
|
ok - so you're saying that values specified on the pages setup screen generate the margin top & bottom values in the @page code ?. makes sense, but how come then, that margin left, margin right elements are not also present in the @page line ( as all the page setup defaults are 5pts ? )
I can't view converted .mobi code, but does calibre add a similar @page line to its mobi output, or is this an epub-specific thing ? last Q: where would I find more info on which epub readers that support top and bottom margins. my son has a sony 350 - does that ? |
![]() |
![]() |
![]() |
#4 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 776
Karma: 2751519
Join Date: Jul 2010
Location: UK
Device: PW2, Nexus7
|
It would be useful to have an option to switch off this @page per html file. Then any @page specified in the stylesheet would automatically apply to all pages. I use an entry in my CSS with units of "px" which means I then have to regex out all the @page blocks which calibre has inserted into the html files.
My Sony reader, (PRS-300), supports @page, so maybe all Sony readers do. Last edited by Agama; 02-11-2011 at 05:58 AM. |
![]() |
![]() |
![]() |
#5 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,720
Karma: 1759970
Join Date: Sep 2010
Device: none
|
Quote:
i don't get the design logic though - why does calibre add it to each html file rather than set it once, globally in css ? |
|
![]() |
![]() |
![]() |
#6 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,144
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
|
![]() |
![]() |
![]() |
#7 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,246
Karma: 16539642
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
|
Interesting. I have also always wondered why the @page info is in each html file. Most of the non-calibre-created epubs I've needed to tweak seem to just use different css classes for special pages such as front and back matter.
|
![]() |
![]() |
![]() |
#8 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,144
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You cannot use a CSS class for an @page rule as far as I know. And setting a top and bottom margin on body is pointless since you want the margins on each screenful of text, bot just the start and end.
|
![]() |
![]() |
![]() |
#9 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,246
Karma: 16539642
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
|
Perhaps I wasn't as clear as I could have been. Most of the epubs I've looked at haven't used @page at all, they've used CSS to force a new page and then applied a large margin-top to the first paragraph. A lot of frontmatter is a bunch of individual single pages. Mind you I mainly read novels.
Last edited by jackie_w; 02-11-2011 at 03:38 PM. |
![]() |
![]() |
![]() |
#10 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,144
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Ah, well calibre's strategy is a lot more flexible.
|
![]() |
![]() |
![]() |
#11 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,720
Karma: 1759970
Join Date: Sep 2010
Device: none
|
Quote:
but next time you run the book through calibre - say to get a .mobi version - it's going to re-insert the default code into every file ? or am I misunderstanding, still ? ( I did partially test this - I removed all the @page stuff from a book with sigil , saved , then re-converted epub to epub with calbre , & saw that it has all been put back again. i did epub to epub to that I could re-examine the output file code. For real, I'd be wanting to do e-pub to mobi. I did not test the effect of altering some of the margin values in some of the files only though ) |
|
![]() |
![]() |
![]() |
#12 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,144
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
MOBI does not support top and bottom margins.
|
![]() |
![]() |
![]() |
#13 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,720
Karma: 1759970
Join Date: Sep 2010
Device: none
|
Hmm- well Kindle mobi does in that I can go to an epub css, add top / bottom margins to any of the .calibre styles, and those changes will show up after converting to mobi & sending to Kindle - the ignore margins option in Kindle output does not negate those
e.g. these margin top settings ( from an actual epub book) both work OK in that I can see them being applied within the Kindle display. Code:
calibre14 { display: block; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 1em; text-align: justify; text-indent: 0 } .calibre15 { display: block; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 11pt; text-align: justify; text-indent: 0 } |
![]() |
![]() |
![]() |
#14 |
US Navy, Retired
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,888
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Kindle PaperWhite SE 11th Gen
|
|
![]() |
![]() |
![]() |
#15 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 776
Karma: 2751519
Join Date: Jul 2010
Location: UK
Device: PW2, Nexus7
|
Unfortunately not, it doesn't actually remove the @page data. Calibre simply adds @page { margin-bottom: 0.000000pt; margin-top: 0.000000pt; } to every file.
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
anyway to change Kindle top/bottom margin? | cdpango | Kindle Developer's Corner | 2 | 11-28-2010 08:20 PM |
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 |
Can't get rid of bottom margin in epubs | ShellShock | Sony Reader | 3 | 02-11-2010 04:15 PM |
calibre ignore margin-top and margin-bottom | bender | Calibre | 2 | 12-11-2009 06:58 AM |