files/en-us/web/css/reference/properties/hyphens/index.md
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.
{{InteractiveExample("CSS Demo: hyphens")}}
hyphens: none;
hyphens: manual;
hyphens: auto;
<section id="default-example">
<p id="example-element">An extraordinarily long English word!</p>
</section>
#example-element {
border: 2px dashed #999999;
font-size: 1.5rem;
text-align: left;
width: 7rem;
}
[!NOTE] In the above demo, the string "An extraordinarily long English word!" contains the hidden
­(soft hyphen) character:An extra­ordinarily long English word!. This character is used to indicate a potential place to insert a hyphen whenhyphens: manual;is specified.
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.
If supported, {{cssxref("hyphenate-character")}} may be used to specify an alternative hyphenation character to use at the end of the line being broken.
/* Keyword values */
hyphens: none;
hyphens: manual;
hyphens: auto;
/* Global values */
hyphens: inherit;
hyphens: initial;
hyphens: revert;
hyphens: revert-layer;
hyphens: unset;
The hyphens property is specified as a single keyword value chosen from the list below.
none
manual
auto
[!NOTE] The
autosetting's behavior depends on the language being properly tagged to select the appropriate hyphenation rules. You must specify a language using thelangHTML attribute to guarantee that automatic hyphenation is applied in that language.
[!NOTE] If you apply
word-break: break-allthen no hyphens are shown, even if the word breaks at a hyphenation point.
There are two Unicode characters used to manually specify potential line break points within text:
­ to insert a soft hyphen.[!NOTE] When the HTML
<wbr>element leads to a line break, no hyphen is added.
{{cssinfo}}
{{csssyntax}}
This example uses three classes, one for each possible configuration of the hyphens property.
<dl>
<dt><code>none</code>: no hyphen; overflow if needed</dt>
<dd lang="en" class="none">An extreme­ly long English word</dd>
<dt>
<code>manual</code>: hyphen only at &hyphen; or &shy; (if needed)
</dt>
<dd lang="en" class="manual">An extreme­ly long English word</dd>
<dt><code>auto</code>: hyphens where the algorithm decides (if needed)</dt>
<dd lang="en" class="auto">An extreme­ly long English word</dd>
</dl>
dd {
width: 55px;
border: 1px solid black;
}
dd.none {
hyphens: none;
}
dd.manual {
hyphens: manual;
}
dd.auto {
hyphens: auto;
}
{{EmbedLiveSample("Specifying_text_hyphenation", "100%", 490)}}
{{Specifications}}
{{Compat}}
word-wrap)