01-19-2015, 03:06 PM | #16 |
ɴₐɴ
Posts: 421
Karma: 2507940
Join Date: Jun 2011
Location: 37.2N 93.3W
Device: KV PW4 PW3 PW2
|
I've been using this in my CSS for AZW3 files on my Paperwhite:
Code:
html { margin-left: -16px; margin-right: -16px; } |
01-20-2015, 05:24 AM | #17 |
Addict
Posts: 254
Karma: 2092424
Join Date: Oct 2011
Location: Arlington, TX
Device: Kindle PW4, Moon+ Reader on a cheap Android tablet
|
|
Advert | |
|
01-22-2015, 12:10 AM | #18 | |
ebooknut
Posts: 297
Karma: 688154
Join Date: Oct 2011
Device: Kindle Voyage & Oasis
|
Quote:
Wondering if the Voyage is that much different from the Paperwhite, or is it because I'm on 5.6.1? Last edited by pssquirrel; 02-16-2015 at 10:55 PM. |
|
01-22-2015, 12:23 AM | #19 |
Addict
Posts: 230
Karma: 13495
Join Date: Feb 2009
Location: SoCal
Device: Kindle 3, Kindle PW, Pocketbook 301+, Pocketbook Touch, Sony 950, 350
|
@pssquirrel
Just try recipe from post #8. This is universal solution, should work on Voyage as well. |
01-22-2015, 09:14 AM | #20 | |
Addict
Posts: 254
Karma: 2092424
Join Date: Oct 2011
Location: Arlington, TX
Device: Kindle PW4, Moon+ Reader on a cheap Android tablet
|
Quote:
|
|
Advert | |
|
01-22-2015, 08:22 PM | #21 |
ebooknut
Posts: 297
Karma: 688154
Join Date: Oct 2011
Device: Kindle Voyage & Oasis
|
@ Section8: Ah. I see what's happening now.
My source material is epub. I delete all margin-left:0 and margin-right:0 so that it uses the epub reader defaults. To get azw3, I convert epub > azw3 using Calibre and add negative margins in the Extra CSS section. If I add negative margins to p, div, h1, h2, etc. everything works out fine. If I use body or html, Calibre will sometimes (but not always) add margin-left:0 and margin-right:0 to the <p> elements, which overrides the negative <body> and <html> margins, rendering them useless. I don't know how Calibre determines when to add margin-left:0 and margin-right:0 to <p>. If anyone has any clues, I'd be curious. However, I have no problem adding negative margins to <p> elements to get the desired results, and it's working fine. Ignore what I wrote above. I was mistaken. I use the Extra CSS section to set negative margins in p, h1, h2, etc. This works fine. However, when I try it with body or html, the Extra CSS doesn't make it into the converted azw3. In this post kovidgoyal (Calibre creator) explains: "Extra css is not going to work for body/html margins. Those are controlled by the page layout section of the conversion dialog." That's why it doesn't work. Nothing to do with overrides or Voyage or 5.6.1, etc. Good to know that, per Section8 and JSWolf below, you can use the html element if you convert from epub > azw3 first, then add it directly to the azw3 CSS using Edit Book. @EbokJunkie: Thanks for your recipe, but I'm on a Mac! Last edited by pssquirrel; 02-16-2015 at 11:00 PM. Reason: corrected info |
01-22-2015, 08:27 PM | #22 | |
Resident Curmudgeon
Posts: 74,669
Karma: 130140792
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
01-22-2015, 09:04 PM | #23 |
Addict
Posts: 254
Karma: 2092424
Join Date: Oct 2011
Location: Arlington, TX
Device: Kindle PW4, Moon+ Reader on a cheap Android tablet
|
I was doing something similar, but based on JimmyR's suggestion above, I just add html { margin-left: -30px; margin-right: -30px; } to the CSS in the azw3, and the margins are reduced on the kindle. The various paragraph classes that calibre sets don't seem to override the html margin.
|
01-22-2015, 11:28 PM | #24 | |
Resident Curmudgeon
Posts: 74,669
Karma: 130140792
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
01-23-2015, 12:17 AM | #25 |
ebooknut
Posts: 297
Karma: 688154
Join Date: Oct 2011
Device: Kindle Voyage & Oasis
|
nevermind
Last edited by pssquirrel; 02-17-2015 at 12:38 PM. |
01-23-2015, 12:08 PM | #26 | |
Member
Posts: 22
Karma: 116
Join Date: Jul 2010
Device: none
|
Quote:
|
|
01-29-2015, 04:37 PM | #27 |
Addict
Posts: 230
Karma: 13495
Join Date: Feb 2009
Location: SoCal
Device: Kindle 3, Kindle PW, Pocketbook 301+, Pocketbook Touch, Sony 950, 350
|
Automated insertion of negative side margin tag html{...}
Please take a look at automated insertion of negative side margin tag html{...} in ePub->azw3 conversion flow. It is similar to those presented in post#8.
In that post Windows batch file provided only partial automation because it demanded user to determine the CSS class name used for paragraph rendering in intermediate ePub file. Now that new idea of universal negative margin tag is suggested it looks as small change to batch file code from post #8 may provide fully automated operation. Read preamble to post #8, download new Python app negmarg2.py, and try this batch file (uses Python 2.7): Code:
:: Parameter #1: epub file name :: Parameter #2: negative margin (enter POSITIVE decimal value in pt). Default is 9 :: :: How to call: ::1. epub2azw3 book.epub :: Provides default negative margins of 9 pt ::2. epub2azw3 book.epub negative_margin :: Provides negative side margins equal to value of parameter "negative_margin" (value must be positive) ebook-convert %1 "%~n1_embed.epub" --output-profile kindle_pw^ --embed-font-family "Charis SIL ModifiedLarger" --subset-embedded-fonts --minimum-line-height 125^ --base-font-size 17 --font-size-mapping 13,13,17,17,18,22,24^ --remove-paragraph-spacing --change-justification justify --margin-top -1 --margin-bottom -1 :: call python applet that inserts negative margin to css file. :: margin is in positive number of points and comes from second parameter of this batch file :: IF SECOND PARAMETER IS MISSING/BLANK DEFAULT VALUE 9 IS SET if [%2]==[] (goto mdef) else goto mspec :mspec :: Parameter #2 is in place py -2.7 "%~dp0negmarg2.py" -e "%~n1_embed.epub" -m %2 goto pass :mdef :: Parameter #2 is blank py -2.7 "%~dp0negmarg2.py" -e "%~n1_embed.epub" -m 9 :pass :: convert epub to mobi kindlegen "%~n1_embed.epub" -locale en -o "%~n1.mobi" :: extract azw3 py -2.7 "%~dp0\lib\kindleunpack.py" -s "%~n1.mobi" "%~n1" :: copy mobi8-*.azw3 file into the current directory copy ".\%~n1\*.azw?" ".\" :: check if old file *.azw3 exists and delete it if exist "%~n1.azw3" del "%~n1.azw3" :: rename mobi8-*.azw3 file call renazw3 "mobi8-%~n1.azw3" :: remove intermediate file del "%~n1_embed.epub" del "%~n1.mobi" :: remove scratch directory with unpacked files rmdir "%~n1" /s /q Note that value of parameter --embed-font-family "Charis SIL ModifiedLarger" you should replace with the name of your favorite font (registered with Windows). Also, you can remove this parameter if you don't want to embed your font. Hope that someone will figure out how to convert this batch file to bash script and migrate it to Mac. Last edited by EbokJunkie; 11-19-2018 at 02:03 PM. |
06-24-2015, 11:49 PM | #28 |
Enthusiast
Posts: 47
Karma: 28546
Join Date: Oct 2011
Device: KOA
|
Code:
html { margin-left: -27px; margin-right: -27px; } adding the below seems to have no effect on the output. Code:
html {
margin-left: -27px;
margin-right: -27px;
margin-top: -27px;
}
Last edited by thoreau; 06-25-2015 at 12:01 AM. |
07-22-2015, 11:28 PM | #29 |
Enthusiast
Posts: 47
Karma: 28546
Join Date: Oct 2011
Device: KOA
|
Anybody know if it's possible to go negative on the top or bottom margins on kindle with css?
|
07-23-2015, 06:07 PM | #30 | |
Addict
Posts: 230
Karma: 13495
Join Date: Feb 2009
Location: SoCal
Device: Kindle 3, Kindle PW, Pocketbook 301+, Pocketbook Touch, Sony 950, 350
|
Quote:
Code:
html { margin: -17pt -11pt -17pt -11pt !important; } |
|
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Best settings for 1:1 ePub to AZW3 conversion? | gers1978 | Conversion | 8 | 06-03-2013 10:50 PM |
azw3 to epub conversion stuck on 1% | krysk | Conversion | 2 | 04-21-2013 11:53 AM |
AZW3 to EPUB Conversion Probs | grizedale | Conversion | 4 | 04-16-2013 06:47 PM |
Conversion from epub to azw3 | Joy736 | Conversion | 12 | 01-01-2013 11:00 AM |
Using negative margins | Agama | Conversion | 0 | 03-03-2012 07:29 AM |