Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > Kindle Formats

Notices

Reply
 
Thread Tools Search this Thread
Old 06-30-2016, 07:31 AM   #1
Phssthpok
Age improves with wine.
Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.
 
Posts: 558
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
CSS compliance in AZW3 books?

I've noticed that my Kindle ignores "page-break-after:avoid" on subheadings, which is pretty annoying; I've also tried to persuade it to do automatic dictionary based hyphenation by putting lang="en" in the <html> tag and then applying various CSS styles to <body>: hyphens, -webkit-hyphens, -moz-hyphens and -ms-hyphens, none of which seem to work.

Can anyone tell me if there's a (probably Kindle-specific) way to do these things? And, does anyone have a list of workarounds for any other CSS things that don't work in AZW3 files?

TIA!
Phssthpok is offline   Reply With Quote
Old 06-30-2016, 07:54 AM   #2
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: 85,544
Karma: 93383043
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
Moved to the "Kindle Formats" forum, where such questions belong.
HarryT is offline   Reply With Quote
Advert
Old 06-30-2016, 07:54 AM   #3
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by Phssthpok View Post
I've noticed that my Kindle ignores "page-break-after:avoid" on subheadings, which is pretty annoying; I've also tried to persuade it to do automatic dictionary based hyphenation by putting lang="en" in the <html> tag and then applying various CSS styles to <body>: hyphens, -webkit-hyphens, -moz-hyphens and -ms-hyphens, none of which seem to work.

Can anyone tell me if there's a (probably Kindle-specific) way to do these things? And, does anyone have a list of workarounds for any other CSS things that don't work in AZW3 files?

TIA!
Wrong forum, try:
https://www.mobileread.com/forums/forumdisplay.php?f=168
which is the Kindle formats forum.
knc1 is offline   Reply With Quote
Old 06-30-2016, 09:11 AM   #4
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 6,470
Karma: 84000001
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Kindles
Quote:
Originally Posted by Phssthpok View Post
I've also tried to persuade it to do automatic dictionary based hyphenation by putting lang="en" in the <html> tag and then applying various CSS styles to <body>: hyphens, -webkit-hyphens, -moz-hyphens and -ms-hyphens, none of which seem to work.
KF8 (AZW3) doesn't support automatic hyphenation. Some people use the Hyphenate This! calibre plugin to add soft hyphens that are supported. Another alternative is conversion to KFX format using the KFX Output calibre plugin.

The Amazon Kindle Publishing Guidelines provides some (incomplete) information about what does and doesn't work in Kindle books.
jhowell is offline   Reply With Quote
Old 06-30-2016, 10:26 AM   #5
Phssthpok
Age improves with wine.
Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.
 
Posts: 558
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
Quote:
Originally Posted by jhowell View Post
KF8 (AZW3) doesn't support automatic hyphenation. Some people use the Hyphenate This! calibre plugin to add soft hyphens that are supported. Another alternative is conversion to KFX format using the KFX Output calibre plugin.

The Amazon Kindle Publishing Guidelines provides some (incomplete) information about what does and doesn't work in Kindle books.
Thanks, I'll look at the plugins.

The Kindle Publishing Guidelines are pretty useless -- nothing about levels of CSS support, just some short platitudes about anchor placement, supported types of space, and don't forget to use entities for <, > and &. Certainly no clue as to why page-break-after:avoid is ignored.
Phssthpok is offline   Reply With Quote
Advert
Old 07-07-2016, 09:07 PM   #6
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 11,447
Karma: 157030631
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
Quote:
Originally Posted by Phssthpok View Post
Thanks, I'll look at the plugins.

The Kindle Publishing Guidelines are pretty useless -- nothing about levels of CSS support, just some short platitudes about anchor placement, supported types of space, and don't forget to use entities for <, > and &. Certainly no clue as to why page-break-after:avoid is ignored.
? Are you reading the full Publisher's Guidelines? Or the Simplified ones?

They have 3 different sets of "guidelines" out. The ones on the web; the downloadable "simplified guidelines" and the actual Publisher's Guidelines. Google for it, and download the PDF. It absolutely is clear on what CSS is supported and which isn't.

We use page-break-after all the time. Something's not right in your file.

Hitch
Hitch is offline   Reply With Quote
Old 07-08-2016, 12:48 AM   #7
AnemicOak
Bookaholic
AnemicOak ought to be getting tired of karma fortunes by now.AnemicOak ought to be getting tired of karma fortunes by now.AnemicOak ought to be getting tired of karma fortunes by now.AnemicOak ought to be getting tired of karma fortunes by now.AnemicOak ought to be getting tired of karma fortunes by now.AnemicOak ought to be getting tired of karma fortunes by now.AnemicOak ought to be getting tired of karma fortunes by now.AnemicOak ought to be getting tired of karma fortunes by now.AnemicOak ought to be getting tired of karma fortunes by now.AnemicOak ought to be getting tired of karma fortunes by now.AnemicOak ought to be getting tired of karma fortunes by now.
 
AnemicOak's Avatar
 
Posts: 14,391
Karma: 54969924
Join Date: Oct 2007
Location: Minnesota
Device: iPad Mini 4, AuraHD, iPhone XR +
Quote:
Originally Posted by Hitch View Post
...and the actual Publisher's Guidelines. Google for it, and download the PDF...
I believe this is the correct link...
https://kindlegen.s3.amazonaws.com/A...Guidelines.pdf
AnemicOak is offline   Reply With Quote
Old 07-08-2016, 04:57 AM   #8
Phssthpok
Age improves with wine.
Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.
 
Posts: 558
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
Quote:
Originally Posted by Hitch View Post
? Are you reading the full Publisher's Guidelines? Or the Simplified ones?

They have 3 different sets of "guidelines" out. The ones on the web; the downloadable "simplified guidelines" and the actual Publisher's Guidelines. Google for it, and download the PDF. It absolutely is clear on what CSS is supported and which isn't.

We use page-break-after all the time. Something's not right in your file.

Hitch
I'm looking at a 102-page PDF from here:
https://kindlegen.s3.amazonaws.com/A...Guidelines.pdf
If that's not the one you mean, can you post me a link please?

In this one, Section 6 is a single page of dos and don'ts; on p.30 it says "Do not insert blank lines of text to create page breaks. Use the CSS page-break-before and page-break-after attributes." It doesn't say anything about avoiding page breaks. Section 16.2 (p.81 onwards) is a list of supported CSS attributes; page-break-after and page-break-before are not listed.

I have <h3> specified as "page-break-after: avoid", but despite this <h3> headings sometimes appear as the last line on a page. Changing "avoid" to "always" appears to work.

So, further advice is welcome.
Phssthpok is offline   Reply With Quote
Old 07-08-2016, 05:08 AM   #9
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,406
Karma: 305065800
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Voyage
Quote:
Originally Posted by Phssthpok View Post
I have <h3> specified as "page-break-after: avoid", but despite this <h3> headings sometimes appear as the last line on a page. Changing "avoid" to "always" appears to work.
Avoid does not mean never, it means "Avoid page break after the element (if possible)". And how clever the software is in interpreting avoid will vary. Clearly avoiding the break by moving the header to the next page isn't something the Kindle does.

"page-break-after: avoid" is NOT the equivalent of the "keep-with-next" attribute in page layout software. It's advice, not a requirement.
pdurrant is offline   Reply With Quote
Old 07-08-2016, 07:12 AM   #10
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: 85,544
Karma: 93383043
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
Yes. "Always" is a command; "avoid" is merely a polite suggestion.
HarryT is offline   Reply With Quote
Old 07-09-2016, 06:29 AM   #11
Notjohn
mostly an observer
Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.
 
Posts: 1,515
Karma: 987654
Join Date: Dec 2012
Device: Kindle
Quote:
Originally Posted by Phssthpok View Post
I'm looking at a 102-page PDF from here:
https://kindlegen.s3.amazonaws.com/A...Guidelines.pdf
That's what I use, anyhow!
Notjohn is offline   Reply With Quote
Old 07-09-2016, 04:59 PM   #12
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 11,447
Karma: 157030631
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
Sorry, my bad:

somehow, I got my head on backwards, and thought we were discussing inserting the page-break-before, yadda. Not the "avoid."

Avoid pretty much doesn't work, ANY-PLACE. Yeah, yeah, in ePUB3, on an iPad, you can kinda rely on it. That's it, however. Maybe ePUB3 in Readium/Azardi. After that, you might as well just light joss sticks and pray a lot.

Hitch
Hitch is offline   Reply With Quote
Old 07-09-2016, 11:38 PM   #13
dgatwood
Curmudgeon
dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.
 
dgatwood's Avatar
 
Posts: 629
Karma: 1623086
Join Date: Jan 2012
Device: iPad, iPhone, Nook Simple Touch
Quote:
Originally Posted by Hitch View Post
Avoid pretty much doesn't work, ANY-PLACE. Yeah, yeah, in ePUB3, on an iPad, you can kinda rely on it. That's it, however. Maybe ePUB3 in Readium/Azardi. After that, you might as well just light joss sticks and pray a lot.
Careful, there. You're overgeneralizing slightly. "Avoid" works in lots of rendering engines, but only when used with "inside", not "before" or "after". Avoiding page breaks inside has worked in WebKit since about 2004, so it should work in Kindle KF8 content as well, with a long list of caveats. Unfortunately, many of the ways that people tend to use it run into one or more of those caveats (#3 below in particular). And, of course, there's no way to get that behavior on MOBI7 readers except to fake it by forcing a page break before the element in question.

AFAIK, even iBooks ignores page-break-after/before:avoid unless they've fixed it in the last year or so and failed to close the canonical bug.

With that said, if you can wrap the two pieces of content in a div and mark that with page-break-inside: avoid, you should usually prevent the break without forcing a break before the first item, provided that:
  1. Neither the enclosing div nor the content inside it uses position: absolute or position: fixed
  2. The content of the enclosing div can fit on a single page
  3. None of the interior elements expand to fill the screen
  4. The enclosing element is a block element (not inline or inline-block or table-*)
  5. The enclosing content is not inside a table (known WebKit bug)

But as mentioned, nothing is guaranteed, and if the renderer cannot make it work, it is allowed to ignore it.

Unfortunately, #3 above makes it unusable for what many folks want to use it for—keeping captions with images—but if you're not trying to do this with an auto-sized image, it ought to work for you. Let us know if it doesn't, because that would be an interesting breakage by Amazon (or an edge case, and I'd have to see your actual code to know which).

Last edited by dgatwood; 07-09-2016 at 11:43 PM.
dgatwood is offline   Reply With Quote
Old 07-10-2016, 01:13 PM   #14
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 11,447
Karma: 157030631
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
Quote:
Originally Posted by dgatwood View Post
Careful, there. You're overgeneralizing slightly.
Agreed. I'm generalizing.

Quote:
"Avoid" works in lots of rendering engines, but only when used with "inside", not "before" or "after". Avoiding page breaks inside has worked in WebKit since about 2004, so it should work in Kindle KF8 content as well, with a long list of caveats. Unfortunately, many of the ways that people tend to use it run into one or more of those caveats (#3 below in particular). And, of course, there's no way to get that behavior on MOBI7 readers except to fake it by forcing a page break before the element in question.
I freely admit that the caveats alone generally render the thing useless. Hell, #2 alone is a headache, as that can change in an instant.

And yes, #3 is usually the killer, because 99% of the time, the client (bookmaker, etc.) is usually trying to slap a caption with an image, as you've mentioned. The image is usually filling the screen, in width, at least, so...that's DOA.

Quote:
AFAIK, even iBooks ignores page-break-after/before:avoid unless they've fixed it in the last year or so and failed to close the canonical bug.
Don't know.

Quote:
With that said, <SNIP>...but if you're not trying to do this with an auto-sized image, it ought to work for you. Let us know if it doesn't, because that would be an interesting breakage by Amazon (or an edge case, and I'd have to see your actual code to know which).
I'll keep my eyes peeled. We have a boatload of complex books going through right now, heavily laden with images, captions, graphics, exhibits, yadda-yadda. I think we've mostly taken to assuming that PBI-avoid doesn't work, for the purposes of what we say to the client or what we promise. I'm also fairly certain that we include it, under the theory that, hey, if it works, great, and if it doesn't, we're no worse off.

Hitch
Hitch is offline   Reply With Quote
Old 07-11-2016, 07:31 AM   #15
Phssthpok
Age improves with wine.
Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.
 
Posts: 558
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
Quote:
Originally Posted by dgatwood View Post
if you can wrap the two pieces of content in a div and mark that with page-break-inside: avoid, you should usually prevent the break without forcing a break before the first item, provided that:
  1. Neither the enclosing div nor the content inside it uses position: absolute or position: fixed
  2. The content of the enclosing div can fit on a single page
  3. None of the interior elements expand to fill the screen
  4. The enclosing element is a block element (not inline or inline-block or table-*)
  5. The enclosing content is not inside a table (known WebKit bug)
I'll try this. If it works more often than it does now (i.e. if it works even once), it's an improvement.

All the same, it seems odd that "avoid" is basically ALWAYS ignored of page-break-after. I would have thought "keep with next (where feasible)" would be a sensible interpretation; oh well. Yes, I know it's only advice, but even my mother's advice wasn't ignored that consistently...

Thanks!

Last edited by Phssthpok; 07-11-2016 at 07:36 AM.
Phssthpok is offline   Reply With Quote
Reply

Tags
azw3, css

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
epub to azw3 conversion and Extra CSS Section8 Conversion 8 02-06-2015 11:55 PM
Epub to AZW3: css formatting not showing topquark Conversion 1 03-20-2013 12:21 AM
Cannot open or convert certain AZW3 books bshar489 Calibre 2 03-18-2013 11:47 AM
Development GPL Compliance jcase enTourage Archive 85 01-03-2011 05:58 PM
pdflrf: Possible non-compliance of GPL terms ashkulz Feedback 2 09-05-2008 12:05 AM


All times are GMT -4. The time now is 04:36 PM.


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