03-07-2015, 12:18 AM | #1 |
Member
Posts: 13
Karma: 10
Join Date: Mar 2015
Device: none
|
iBooks margins and clipping
Hello everyone,
I'm making an epub book and I'm trying to get it to work well across multiple platforms. I read this on this site (https://wiki.mobileread.com/wiki/EPub): "The iBooks reader prevents problems with text ending up in the margins (and getting clipped) by setting -webkit-line-box-contain: block glyphs replaced;." Should I actually insert this in my css? Like this: html {-webkit-line-box-contain: block glyphs replaced;} or does iBooks somehow automatically "set" this without the creator needing to put it in their style sheet? I don't have a Mac so I have no way to test this. And more importantly, does anyone know if including this code could adversely affect how the book will be displayed on other devices/software besides iBooks? I'm unfamiliar with this particular style and don't really understand what it does exactly. And I'm having trouble finding a clear discussion of it online. Thank you everyone very much for your help. |
03-07-2015, 01:31 AM | #2 | |
Curmudgeon
Posts: 629
Karma: 1623086
Join Date: Jan 2012
Device: iPad, iPhone, Nook Simple Touch
|
Quote:
Unfortunately, the result is that these drop caps are rendered lower than they are in any other reader, and can potentially even collide with the line of text below them. For this reason, if your drop caps stick up above the paragraph, you should specify the "inline" form in your stylesheet, which overrides the default reader stylesheet, and tells the underlying WebKit engine not to shift the drop cap down. The best way to test your content if you don't have a Mac or an iPhone is to grab a copy of WebKit (free, runs on most platforms). For previewing the way pagination will happen, print the page to PDF with variable page sizes. This isn't 100% accurate by any means, but it is a decent starting point that will get you about 85% of the way there, with the biggest difference being image handling behavior. Of course, WebKit doesn't include the "glyphs" form of that style in its own default stylesheet, so if you want to better approximate what it will look like in iBooks, you can add: Code:
html {-webkit-line-box-contain: block glyphs replaced;} Code:
html {-webkit-line-box-contain: block inline replaced;} IMPORTANT: If a paragraph containing a drop cap could realistically appear at the very top of a page, you must use padding-top on that paragraph to ensure that the drop cap can never stick up above the top margin of the page. (After a page break, the margin-top property of a paragraph is zeroed, so you must use padding-top rather than margin-top, to ensure the necessary separation.) |
|
03-07-2015, 11:36 AM | #3 |
Member
Posts: 13
Karma: 10
Join Date: Mar 2015
Device: none
|
Thank you dgatwood for your very thoughtful reply. It totally answers my question.
|
03-07-2015, 08:43 PM | #4 |
Resident Curmudgeon
Posts: 73,957
Karma: 128903250
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
But, if you are doing this for an eBook you plan on selling, you might have to remove your webkit commands in order to get it to validate.
|
03-08-2015, 03:22 PM | #5 | |
Curmudgeon
Posts: 629
Karma: 1623086
Join Date: Jan 2012
Device: iPad, iPhone, Nook Simple Touch
|
Quote:
I mean if you want it to get a clean bill of health without any warnings from something marginally abusive like the CSS linter, then maybe, but doing that is usually incompatible with getting usable results anyway. (For example, overqualifying selectors is often required if the reader's UA stylesheet is abusive/evil.) |
|
03-08-2015, 10:50 PM | #6 |
Resident Curmudgeon
Posts: 73,957
Karma: 128903250
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
|
03-09-2015, 09:44 AM | #7 | |
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
As far as I know, epubcheck validation is the same. It may warn about unknown properties (which is fine, they may be misspelt, or the content may rely too much on them), but it should not flag them as an error. And a renderer choking on unknown CSS properties is just buggy. |
|
03-09-2015, 11:38 AM | #8 | |
Resident Curmudgeon
Posts: 73,957
Karma: 128903250
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
03-09-2015, 02:39 PM | #9 | |
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
I often use properties that are not strictly part of CSS 2 or ePub 2 (visibility, opacity, text-transform, hyphens...), and I don't recall ADE having a problem with them, other than ignoring them. It does ignore the whole CSS if there is a syntax error, like a missing semicolon or wrong units in a value, but that's different. So, my advice with CSS: use whatever you want, validate and test with ADE. If it's not seriously broken, go ahead. |
|
03-10-2015, 10:27 PM | #10 | |
Curmudgeon
Posts: 629
Karma: 1623086
Join Date: Jan 2012
Device: iPad, iPhone, Nook Simple Touch
|
Quote:
The only standard-ish rule that I've seen ADE barf on is a workaround for opacity problems in older versions of the IE rendering engine: Code:
filter:alpha(opacity=0); Last edited by dgatwood; 03-10-2015 at 10:29 PM. |
|
Tags |
box, glyphs, ibooks, margins, webkit |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
iPhone Wanting no margins in epub for iBooks | LouisAllan | Apple Devices | 22 | 01-06-2013 06:52 PM |
epub Margins in iBooks on iPhone/iPod Touch | alwright1 | Conversion | 6 | 02-02-2011 12:14 PM |
iPad iBooks & margins | JSWolf | Apple Devices | 10 | 05-24-2010 05:19 PM |
Clipping ? | Prince Hal | Interead COOL-ER | 2 | 02-22-2010 09:30 PM |
font clipping | Jadon | Fictionwise eBookwise | 2 | 11-03-2008 05:37 PM |