![]() |
#1 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 668
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
p+p indent flaky
I've see a few books using this CSS:
p{margin:0;text-align:justify;} p+p{text-indent:1.4em;} This idea being that the first para of a section after a heading was unindented, as it should be, the following indented. And this works in epub readers. But when converted to AZW3 and loaded in a Kindle (PW3 with 5.10.3) I found it erratic. Every few pages a paragraph would be unindented. Checking the source, the paras were all <p>. Also, if I changed the fontsize, reflowed the text, often the para in question would become indented. So is this a bug in the AZW3 or is the Kindle renderer itself buggy? Has this been fixed in later versions? In any case, I'm giving up using this "+" trick as unreliable. Last edited by AlanHK; 04-02-2022 at 02:52 AM. |
![]() |
![]() |
![]() |
#2 |
the rook, bossing Never.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,060
Karma: 89198465
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
|
I use two styles in the wordprocessor, a a flush first paragraph for after any centred item and an an indented style for all others. That works perfectly. I never have to edit HTML or CSS of books converted from docx to epub2.
If it's an existing ebook using same style for all paragraphs I copy that CSS and have one with indent and one without. Then for any centred styles I search for the close of centred style tag & the paragraph defualt tag/style and replace. Very quick. Works on Amazon's conversion from epub2 to mobi, azw3 & KFX and also for epub2 conversion to Dual Mobi for Smashwords. |
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 668
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
Quote:
But I came across a few books that use the p+p trick and thought it was useful and made a simpler code. However, it just does not work reliably in Kindle, so I reverted to explicitly setting each para's style. Code:
p {margin:0; text-indent:1.4em; text-align:justify;} .first {margin-top:1.5em; text-indent:0;} all other p styles have to set indent to 0. |
|
![]() |
![]() |
![]() |
#4 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 75,307
Karma: 133361584
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
This is what I use. The hr is the section break marker. It works in ePub, KF8, Mobi, KePub, and KFX.
Code:
hr { margin-top: 1em; margin-right: 40%; margin-bottom: 0.9em; margin-left: 40%; border-top: 2px solid; } p { margin-top: 0; margin-bottom: 0; text-indent: 1.2em; } .noindent { text-indent: 0 } Code:
<p>Last line of the section</p> <hr/> <p class="noindent">This is the first line of a new section</p> |
![]() |
![]() |
![]() |
#5 | |
Bookmaker & Cat Slave
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,468
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
|
Quote:
What happens when you take an ePUB that has that working and drop it on KP3, instead?, Then export that as MOBI, and sideload it to your Paperwhite? Hitch |
|
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Running with scissors
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,552
Karma: 14325282
Join Date: Nov 2019
Device: none
|
Quote:
Code:
dl + p, hr + p, header + p, p:first-child { margin-top: 1.0em; text-indent: 0em; } body p { margin: 0; padding: 0; text-indent: 2em; } In other words, only specify where you don't want an indent. Also, the logic this way is clearer; saying "no indent for p, but then indent a p when it's after a p" can be confusing for someone looking at your css. With coding/programming it's usually better to make things clear and avoid clever tricks that could be misunderstood or hard to understand. Last edited by hobnail; 04-05-2022 at 04:01 PM. |
|
![]() |
![]() |
![]() |
#7 | ||
Bookmaker & Cat Slave
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,468
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
|
Quote:
Quote:
Hitch |
||
![]() |
![]() |
![]() |
#8 |
Running with scissors
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,552
Karma: 14325282
Join Date: Nov 2019
Device: none
|
Yes, that's true. But when the code changes only in an idealized world does everyone keep their comments up to date to match the code. So developing a habit to write clear code without clever tricks is a good strategy for when the comments don't match the code, or if they forget to write comments.
|
![]() |
![]() |
![]() |
#9 | |
Bookmaker & Cat Slave
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,468
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
|
Quote:
Hitch |
|
![]() |
![]() |
![]() |
#10 |
Running with scissors
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,552
Karma: 14325282
Join Date: Nov 2019
Device: none
|
Sure, we all do. I just don't like hacky, clever code, with or without comments. I don't want to have trouble figuring out what the code does and then wonder if it doesn't match the comment.
Last edited by hobnail; 04-06-2022 at 01:12 AM. |
![]() |
![]() |
![]() |
#11 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 75,307
Karma: 133361584
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
Code:
p { margin-top: 0; margin-bottom: 0; text-indent: 1.2em; } .noindent { text-indent: 0; } |
|
![]() |
![]() |
![]() |
#12 | |
Running with scissors
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,552
Karma: 14325282
Join Date: Nov 2019
Device: none
|
Quote:
Last edited by hobnail; 04-06-2022 at 01:36 PM. |
|
![]() |
![]() |
![]() |
#13 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 75,307
Karma: 133361584
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
|
![]() |
![]() |
![]() |
#14 |
the rook, bossing Never.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,060
Karma: 89198465
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
|
If you are using styles in Word or LO Writer and convert a docx to epub in Calibre and then the epub to anything else, it works on everything and the CSS & HTML isn't much different to JSWOLF's suggestion.
|
![]() |
![]() |
![]() |
#15 | |
Bookmaker & Cat Slave
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,468
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
|
Quote:
Although, having said that, you can sorta do it by setting the "next paragraph" in the style of the block-style paragraph so that the next paragraph is body text, and all the ensuing paragraphs are body text, until you get to the first para of the next chapter, whereupon you use the block style and then lather-rinse-repeat. It is almost as good as using p+p. In some ways, better. You can even do it by setting the heading style for the chapter header to have "next paragraph" be the block-style, and then the block-style has the next paragraph as body, (and proceed from there, like I said above), and do it that way. (I do this in my Word "template" documents, which I use to show a customer what a given layout in a given font might look like. I have all the headings and styles with dependencies, so if someone thinks that they want, for example, Bookman Old Style, I can change ONE thing, ONE style in the Word doc and the change dominoes (cascades) through the entire file. Export a PDF and give them an idea of what they might be looking at. It's the same thing, really, as we're discussing with p+p.) Hitch |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Aura ONE Battery Woes, and flaky tech support | richrock | Kobo Reader | 2 | 10-26-2019 08:28 AM |
Flaky Wi-Fi Hopefully Fixed | Richwood | Lounge | 2 | 02-13-2018 11:14 AM |
Glo HD USB port flaky | madhg | Kobo Reader | 3 | 09-24-2016 08:48 PM |
Touch touch is flaky | Mellobob | Barnes & Noble NOOK | 5 | 06-22-2011 12:20 PM |
PRS-600 Flaky Reader Behaviour | ChristopherTD | Sony Reader | 2 | 02-15-2010 02:09 AM |