Words and paragraphs

Continuing with typography features, we now enter the word and paragraph properties.

Let's get going.

hyphens

The hyphens CSS property tells the browser how to handle hyphenation when text lines wrap, and it looks like this:

hyphens: auto;

Description

We can control when to hyphenate and whether to allow it or let it happen under certain conditions.

Hyphenation is language dependent. The language in a document is defined by the lang attribute; browsers will hyphenate if they support the language and a proper hyphenation dictionary is available. Each browser supports hyphenation differently.

Tip

Ensure that the lang attribute is declared either globally on the <html> tag or on the specific element whose content should be hyphenated. ...

Get Web Developer's Reference Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.