Skip to content
Tutorials Center
My learning

Topics

CSS Reference ยท Typography

The hyphens property

Reference for the CSS hyphens property: none, manual and auto. Learn how soft hyphens work, why the lang attribute matters, and how to avoid ugly line breaks.

The hyphens property controls whether a browser may split a word across two lines with a hyphen. It works with three modes: never hyphenate (none), hyphenate only where you placed hint characters (manual, the default), or let the browser find break points with a dictionary (auto).

Hyphenation makes narrow columns, justified text and long compound words look much better, because the gaps between words stay even. It only needs one line of CSS plus a correct lang attribute on the page.

CSS
article {
  hyphens: auto;
}

Try it

none, manual and auto

The word may wrap without a hyphen in the first box (or overflow it), and breaks with a hyphen in the second. In the third, the result depends on whether your browser ships an English hyphenation dictionary.

Syntax

CSS
hyphens: none | manual | auto;
Initial value manual
Applies to all elements
Inherited yes
Animatable no
Computed value as specified

Values

Value Description
none Words are never hyphenated, even where a soft hyphen (­) is present. Visible hyphens in the text (a literal -) still allow a break.
manual Words break only at explicit break points: the soft hyphen character ­ (U+00AD) or a literal hyphen. This is the default.
auto The browser may add break points using a language-specific dictionary, in addition to any manual ones.

Usage notes

  • Set lang. hyphens: auto needs to know the language, so declare it on <html> or on the element (lang="en"). Without it, nothing is hyphenated.
  • Dictionary coverage varies. Not every browser or operating system has dictionaries for every language, and results can differ. Treat auto as a progressive enhancement and make sure the layout is acceptable without it.
  • Soft hyphens are invisible until needed. &shy; shows a hyphen only if the line breaks at that point. It is good for a few long words you know about, such as a product name.
  • Search and copy. Soft hyphens inside words can disturb text search or copy and paste in some contexts. Use them sparingly.
  • Pair with justification. text-align: justify without hyphenation can leave wide gaps in narrow columns. Hyphenation reduces them.
  • Screen readers read the whole word. Hyphenation is purely visual.
  • Fine-tuning. You can change the hyphen glyph with hyphenate-character. For long, unbreakable strings such as URLs, use overflow-wrap instead.

Browser support

hyphens is supported in current browsers, but auto depends on the dictionaries each browser provides for the language, so verify the languages you publish in.