03-08-2019, 11:52 PM | #1 |
Wizard
Posts: 3,413
Karma: 13369310
Join Date: May 2008
Location: Launceston, Tasmania
Device: Sony PRS T3, Kobo Glo, Kindle Touch, iPad, Samsung SB 2 tablet
|
Can I prevent hyphenation in a block of text?
I'm working on an epub ebook which in each of its 18 books and 208 chapters has a 'preface' of several words or a few sentences. The text of the 'preface' is centered, often using several lines, and quite often the last word on a line breaks, and is hyphenated. I think this looks awful.
Is there a way to prevent all of the words in the centered text from breaking? A word at the end of a line which would otherwise break will then drop to the next line. I know how to prevent a single word from breaking and hyphenating. But I really don't want to have to apply this markup to all or most of the words in each of the 226 'prefaces'. |
03-09-2019, 06:49 AM | #2 | |
Wizard
Posts: 1,602
Karma: 7999999
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
Code:
.no_hyphens { adobe-hyphenate: none; hyphenate: none; hyphens: none; -epub-hyphens: none; -moz-hyphens: none; -webkit-hyphens: none; } 1) Enclose the text to be not hyphened in a div tag with the class previously defined; i.e: Code:
<div class="no_hyphens"> <p>blah, blah, blah...</p> <p>blah, blah, blah...</p> <p>blah, blah, blah...</p> </div> if you have: Code:
<h2 class="title">This is my own title</h2> Code:
<h2 class="title no_hyphens">This is my own title</h2> Code:
<p class="center">The text of my preface here....</p> Code:
<p class="center no_hyphens">The text of my preface here....</p> Rubén |
|
Advert | |
|
03-10-2019, 12:54 AM | #3 |
Wizard
Posts: 3,413
Karma: 13369310
Join Date: May 2008
Location: Launceston, Tasmania
Device: Sony PRS T3, Kobo Glo, Kindle Touch, iPad, Samsung SB 2 tablet
|
Thanks so much, Rubén. That's most helpful.
|
03-10-2019, 10:53 AM | #4 |
Wizard
Posts: 1,602
Karma: 7999999
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
|
03-12-2019, 04:45 PM | #5 | |
Resident Curmudgeon
Posts: 76,002
Karma: 134368292
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
Advert | |
|
03-12-2019, 11:48 PM | #6 |
Obsessively Dedicated...
Posts: 3,200
Karma: 34978132
Join Date: May 2011
Location: JAPAN (US expatriate)
Device: Sony PRS-T2, ADE on PC
|
@JSWolf -- I think that only happens if you are using text-align: justify.
Centered text shouldn't be changing spacing between words. Last edited by GrannyGrump; 03-13-2019 at 10:26 PM. |
03-15-2019, 02:41 PM | #7 |
Resident Curmudgeon
Posts: 76,002
Karma: 134368292
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
|
03-15-2019, 08:09 PM | #8 |
Wizard
Posts: 3,413
Karma: 13369310
Join Date: May 2008
Location: Launceston, Tasmania
Device: Sony PRS T3, Kobo Glo, Kindle Touch, iPad, Samsung SB 2 tablet
|
Yes, I am using centered text for the 'preface' to the books and chapters. I don't see any problems at all. Rubén's solution works very well indeed, though I have made very minor changes to give me a space on either side and below the 'preface' text.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Forcing indexing to skip a block of text? | andyb | Sigil | 15 | 05-03-2017 08:19 PM |
Troubleshooting Text size changed after running the hyphenation plugin on an azw3 book | agnul | Amazon Kindle | 0 | 10-14-2015 06:23 AM |
Aura H2O, no hyphenation in Adobe reader for left-aligned text | jchtt | Kobo Reader | 9 | 12-02-2014 05:04 PM |
Isolated Block of Text | crutledge | Sigil | 10 | 06-22-2013 02:49 PM |
Prevent titles hyphenation in iPad and iPhone | fante1998 | ePub | 0 | 02-24-2012 05:43 AM |