Using alignment and hyphenation properly can make your
text look better, especially on a small screen.
Justified text (when your text goes all the way to the right margin on each line) will result in empty spaces in the middle of lines. Changing to left alignment gets rid of the spaces, but leaves a ragged right margin. Hyphenation can fix that.
Hyphenation isn't supported in all browsers (not Chrome, Opera or Android), but that's OK. Hyphenation is an example of progressive enhancement.
It's a nice add-on for the browsers that can do it, but users with other browsers won't be missing out on anything if they don't get it.
In order for hyphenation to work, the browser needs to know what language the text is in. You can use the lang attribute on any element, but generally it’'s easiest to put it in the html element if the page is all in one language.
If you don't have a lang attribute, the browser will not hyphenate anything. Keep in mind that each browser can only hyphenate certain languages. See netm.ag/hyphens-267 (opens in new tab) for more information on browser and language compatibility.
Clarissa Peterson is a UX designer and web developer at Peterson/Kandy, and the author of Learning Responsive Web Design. This article was originally published in net magazine (opens in new tab) issue 267.
Liked this? Read these!