How can I use hyphenation in Google Chrome browser?
Asked Answered
E

3

43

I use the following css to auto hyphen text in my website:

-webkit-hyphens: auto;
-moz-hyphens: auto;
-ms-hyphens: auto;
hyphens: auto;

But in chrome this has no effect. I already read, that chrome doesn't support this. Is there any workaround for hyphenation in chrome? Thanks!

Exile answered 19/8, 2015 at 11:46 Comment(5)
no pure css solution. but if use javascripit , it can be done, check out this javascript library linkResurge
Star this chromium issue and comment on it: bugs.chromium.org/p/chromium/issues/detail?id=47083Pussy
The chrome-team is working on this: bugs.chromium.org/p/chromium/issues/detail?id=605840Keddah
Works in Mac/Android Chrome since Nov 2016, but not on Windows.Delp
In Chrome (62.0) you can currently use hyphens: initial to undo a previous hyphens: none (and allow hyphenation at ­) though the property doesn't appear to support setting any specific value other than none.Thomism
R
26

Hyphenation is currently supported on Chrome only on Android and macOS (and only the "auto" value), as you can see here: http://caniuse.com/#search=hyphens

I used Hyphenator too, as suggested by Eric.

Reformed answered 9/12, 2015 at 11:3 Comment(3)
There's no hypenathor in that production website.Asel
@Asel that's true, the site has changed in the meanwhile. You can see it in these archive.org snapshot: web.archive.org/web/20150419034614/http://www.chiantibanca.it/…Reformed
The hyphenation does not work in Chrome on MacOs. I'm not sure about Google's Official position, but even the online CS "Try It Now" sites don't work.Trichromat
K
7

In case anyone else made the mistake I did, hyphens only work if you declare the language in the HTML tag. For example: <html lang="en-GB">

Without a language declared hyphens:auto will do nothing.

Kutch answered 16/7, 2021 at 7:38 Comment(0)
S
6

Soft hyphens can be applied with JavaScript (best solution) or any server-side language, however, that answers the question with its own answer.

Sammons answered 19/5, 2016 at 15:49 Comment(1)
That's true - unfortunately the only way for chrome right now. But beware: Doing this can affect accessibility: Screen readers will read every syllable, not whole wordsSchexnayder

© 2022 - 2024 — McMap. All rights reserved.