by andrei_says_ · 6y ago · 0 comments
Browsers don’t hyphenate, so avoid justified text on the web.
In Google Chrome, you'll see that it hyphenates "profes-sional" in the second story of the center column. It's still not enough, though, because it still leaves huge gaps in the justified text; it works best when you use width: 80ch. The page is currently using width: 600px, which is approximately 67ch.
(If you don't see hyphenation in Safari, that's because the developer didn't enable -webkit-hyphens. If you don't see hyphenation in Firefox, that's because the page's <html> tag doesn't have a lang="en" attribute.)
var Hyphenopoly = {
require: {
"en-us": "Supercalifragilisticexpialidocious"
},
setup: {
selectors: {
".story": {}
},
CORScredentials: "omit"
}
}
script = document.createElement('script')
script.src = 'https://unpkg.com/hyphenopoly@4.5.0/min/Hyphenopoly_Loader.js'
document.body.append(script)I know real newspapers do hyphenate, but the site would probably look a lot less like a newspaper without justified text.
Probably because hyphenation is itself a rabbit-hole of complexity; some languages may require a complete dictionary to determine where words can be hyphenated, and sometimes it could depend on what style guide you follow, etc.
> Only supported on Android & Mac platforms (and only the "auto" value) for now.
Even where the property is supported, the supported language matrix [2] tells a depressing story.
[1] https://caniuse.com/#feat=css-hyphens
[2] https://developer.mozilla.org/en-US/docs/Web/CSS/hyphens#Bro...