W3cubDocs

/CSS

hyphens

The hyphens CSS property specifies how words should be hyphenated when text wraps across multiple lines. It can prevent hyphenation entirely, hyphenate at manually-specified points within the text, or let the browser automatically insert hyphens where appropriate.

Hyphenation rules are language-specific. In HTML, the language is determined by the lang attribute, and browsers will hyphenate only if this attribute is present and the appropriate hyphenation dictionary is available. In XML, the xml:lang attribute must be used.

Note: The rules defining how hyphenation is performed are not explicitly defined by the specification, so the exact hyphenation may vary from browser to browser.

Syntax

/* Keyword values */
hyphens: none;
hyphens: manual;
hyphens: auto;

/* Global values */
hyphens: inherit;
hyphens: initial;
hyphens: unset;

The hyphens property is specified as a single keyword value chosen from the list below.

Values

none
Words are not broken at line breaks, even if characters inside the words suggest line break points. Lines will only wrap at whitespace.
manual
Words are broken for line-wrapping only where characters inside the word suggest line break opportunities. See Suggesting line break opportunities below for details.
auto
The browser is free to automatically break words at appropriate hyphenation points, following whatever rules it chooses. However, suggested line break opportunities (see Suggesting line break opportunities below) will override automatic break point selection when present.

Note: The auto setting's behavior depends on the language being properly tagged to select the appropriate hyphenation rules. You must specify a language using the lang HTML attribute to guarantee that automatic hyphenation is applied in that language.

Suggesting line break opportunities

There are two Unicode characters used to manually specify potential line break points within text:

U+2010 (HYPHEN)
The "hard" hyphen character indicates a visible line break opportunity. Even if the line is not actually broken at that point, the hyphen is still rendered.
U+00AD (SHY)
An invisible, "soft" hyphen. This character is not rendered visibly; instead, it marks a place where the browser should break the word if hyphenation is necessary. In HTML, use ­ to insert a soft hyphen.

When the HTML <wbr> element leads to a line break, no hyphen is added.

Formal definition

Initial value manual
Applies to all elements
Inherited yes
Computed value as specified
Animation type discrete

Formal syntax

none | manual | auto

Examples

Specifying text hyphenation

This example uses three classes, one for each possible configuration of the hyphens property.

HTML

<dl>
  <dt><code>none</code>: no hyphen; overflow if needed</dt>
  <dd lang="en" class="none">An extreme&shy;ly long English word</dd>
  <dt><code>manual</code>: hyphen only at &amp;hyphen; or &amp;shy; (if needed)</dt>
  <dd lang="en" class="manual">An extreme&shy;ly long English word</dd>
  <dt><code>auto</code>: hyphens where the algorithm decides (if needed)</dt>
  <dd lang="en" class="auto">An extreme&shy;ly long English word</dd>
</dl>

CSS

dd { 
  width: 55px;
  border: 1px solid black;
 }
dd.none {
  -webkit-hyphens: none;
  -ms-hyphens: none;
  hyphens: none;
}
dd.manual {
  -webkit-hyphens: manual;
  -ms-hyphens: manual;
  hyphens: manual;
}
dd.auto {
  -webkit-hyphens: auto;
  -ms-hyphens: auto;
  hyphens: auto;
}

Result

Specifications

Specification Status Comment
CSS Text Module Level 3
The definition of 'hyphens' in that specification.
Working Draft Initial definition

Browser compatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
hyphens 55
55
auto value is only supported on macOS and Android and for languages the OS provides hyphenation for.
13
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
Only -webkit-hyphens: none is supported.
12
Prefixed
12
Prefixed
Prefixed Implemented with the vendor prefix: -ms-
Only works if the specified language is the same as the language of the underlying OS.
43
43
6
Prefixed
Prefixed Implemented with the vendor prefix: -moz-
Automatic hyphenation only works for languages with hyphenation dictionaries that are integrated into Firefox.
10
Prefixed
10
Prefixed
Prefixed Implemented with the vendor prefix: -ms-
Only works if the specified language is the same as the language of the underlying OS.
44
44
auto value is only supported on macOS and Android.
5.1
Prefixed
5.1
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
Hyphenation dictionary for Afrikaans (af, af-*) No No 8 No No No
Hyphenation dictionary for Bosnian, Serbian, and Serbo-Croatian (sh, sh-*, sr, sr-*, bs, bs-*) No No 8 No No No
Hyphenation dictionary for Bulgarian (bg, bg-*) No No 8 No No No
Hyphenation dictionary for Catalan (ca, ca-*) No No 8 No No 5.1
Hyphenation dictionary for Croatian (hr, hr-*) No No 8 No No 9.1
Hyphenation dictionary for Czech (cs, cs-*) No No No No No 9.1
Hyphenation dictionary for Danish (da, da-*) No No 8 No No 5.1
Hyphenation dictionary for Dutch (nl, nl-*) No No 8 No No 5.1
Hyphenation dictionary for English (en, en-*) 55 12 6
6
For English, Firefox uses an en-US dictionary
10 44 5.1
5.1
For English, Safari uses different en-GB and en-US dictionaries.
Hyphenation dictionary for Esperanto (eo, eo-*) No No 8 No No No
Hyphenation dictionary for Estonian (et, et-*) No No 8 No No No
Hyphenation dictionary for Finnish (fi, fi-*) No No 8 No No 9.1
Hyphenation dictionary for French (fr, fr-*) No No 8 No No 5.1
Hyphenation dictionary for Galician (gl, gl-*) No No 9 No No No
Hyphenation dictionary for German, Reformed Orthography of 1996 (de, de-1996, de-DE, de-AT, de-*) No No 8 No No 5.1
Hyphenation dictionary for German, Swiss Orthography (de-CH, de-CH-*) No No 8 No No No
Hyphenation dictionary for German, Traditional Orthography of 1901 (de-1901, de-AT-1901, de-DE-1901) No No 8 No No No
Hyphenation dictionary for Hungarian (hu, hu-*) No No 9 No No 9.1
Hyphenation dictionary for Icelandic (is, is-*) No No 8 No No No
Hyphenation dictionary for Interlingua (ia, ia-*) No No 8 No No No
Hyphenation dictionary for Italian (it, it-*) No No 9 No No 5.1
Hyphenation dictionary for Kurmanji (kmr, kmr-*) No No 8 No No No
Hyphenation dictionary for Latin (la, la-*) No No 8 No No No
Hyphenation dictionary for Lithuanian (lt, lt-*) No No 8 No No No
Hyphenation dictionary for Mongolian (mn, mn-*) No No 8 No No No
Hyphenation dictionary for Norwegian (Nynorsk) (nn, nn-*) No No 8 No No No
Hyphenation dictionary for Norwegian (Bokmål) (no, no-*, nb, nb-*) No No 8 No No 5.1
Hyphenation dictionary for Polish (pl, pl-*) No No 31 No No 9.1
Hyphenation dictionary for Portuguese (pt, pt-*) No No 8 No No 9.1
Hyphenation dictionary for Brazilian Portuguese (pt-BR) No No 8
8
For Brazilian Portuguese, Firefox uses a Portuguese dictionary.
No No No
Hyphenation dictionary for Russian (ru, ru-*) No No 8 No No 5.1
Hyphenation dictionary for Slovenian (sl, sl-*) No No 8 No No No
Hyphenation dictionary for Spanish (es, es-*) No No 8 No No 5.1
Hyphenation dictionary for Swedish (sv, sv-*) No No 8 No No 5.1
Hyphenation dictionary for Turkish (tr, tr-*) No No 9 No No 5.1
Hyphenation dictionary for Ukrainian (uk, uk-*) No No 9 No No 9.1
Hyphenation dictionary for Upper Sorbian (hsb, hsb-*) No No 8 No No No
Hyphenation dictionary for Welsh (cy, cy-*) No No 8 No No No
Mobile
Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
hyphens 55
55
4
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
55
55
18
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
43
43
6
Prefixed
Prefixed Implemented with the vendor prefix: -moz-
Automatic hyphenation only works for languages with hyphenation dictionaries that are integrated into Firefox.
43 4.2
Prefixed
4.2
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
6.0
6.0
1.0
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
Hyphenation dictionary for Afrikaans (af, af-*) No No 8 No No No
Hyphenation dictionary for Bosnian, Serbian, and Serbo-Croatian (sh, sh-*, sr, sr-*, bs, bs-*) No No 8 No No No
Hyphenation dictionary for Bulgarian (bg, bg-*) No No 8 No No No
Hyphenation dictionary for Catalan (ca, ca-*) No No 8 No 5 No
Hyphenation dictionary for Croatian (hr, hr-*) No No 8 No 9.3 No
Hyphenation dictionary for Czech (cs, cs-*) No No No No 9.3 No
Hyphenation dictionary for Danish (da, da-*) No No 8 No 5 No
Hyphenation dictionary for Dutch (nl, nl-*) No No 8 No 5 No
Hyphenation dictionary for English (en, en-*) 55 55 6
6
For English, Firefox uses an en-US dictionary
43 6
6
For English, Safari uses different en-GB and en-US dictionaries.
6.0
Hyphenation dictionary for Esperanto (eo, eo-*) No No 8 No No No
Hyphenation dictionary for Estonian (et, et-*) No No 8 No No No
Hyphenation dictionary for Finnish (fi, fi-*) No No 8 No 9.3 No
Hyphenation dictionary for French (fr, fr-*) No No 8 No 5 No
Hyphenation dictionary for Galician (gl, gl-*) No No 9 No No No
Hyphenation dictionary for German, Reformed Orthography of 1996 (de, de-1996, de-DE, de-AT, de-*) No No 8 No 5 No
Hyphenation dictionary for German, Swiss Orthography (de-CH, de-CH-*) No No 8 No No No
Hyphenation dictionary for German, Traditional Orthography of 1901 (de-1901, de-AT-1901, de-DE-1901) No No 8 No No No
Hyphenation dictionary for Hungarian (hu, hu-*) No No 9 No 9.3 No
Hyphenation dictionary for Icelandic (is, is-*) No No 8 No No No
Hyphenation dictionary for Interlingua (ia, ia-*) No No 8 No No No
Hyphenation dictionary for Italian (it, it-*) No No 9 No 5 No
Hyphenation dictionary for Kurmanji (kmr, kmr-*) No No 8 No No No
Hyphenation dictionary for Latin (la, la-*) No No 8 No No No
Hyphenation dictionary for Lithuanian (lt, lt-*) No No 8 No No No
Hyphenation dictionary for Mongolian (mn, mn-*) No No 8 No No No
Hyphenation dictionary for Norwegian (Nynorsk) (nn, nn-*) No No 8 No 5 No
Hyphenation dictionary for Norwegian (Bokmål) (no, no-*, nb, nb-*) No No 8 No 5 No
Hyphenation dictionary for Polish (pl, pl-*) No No 31 No 9.3 No
Hyphenation dictionary for Portuguese (pt, pt-*) No No 8 No 9.3 No
Hyphenation dictionary for Brazilian Portuguese (pt-BR) No No 8
8
For Brazilian Portuguese, Firefox uses a Portuguese dictionary.
No No No
Hyphenation dictionary for Russian (ru, ru-*) No No 8 No 5 No
Hyphenation dictionary for Slovenian (sl, sl-*) No No 8 No No No
Hyphenation dictionary for Spanish (es, es-*) No No 8 No 5 No
Hyphenation dictionary for Swedish (sv, sv-*) No No 8 No 5 No
Hyphenation dictionary for Turkish (tr, tr-*) No No 9 No 5 No
Hyphenation dictionary for Ukrainian (uk, uk-*) No No 9 No 9.3 No
Hyphenation dictionary for Upper Sorbian (hsb, hsb-*) No No 8 No No No
Hyphenation dictionary for Welsh (cy, cy-*) No No 8 No No No

See also

© 2005–2020 Mozilla and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/hyphens