hyphens

  • Revision slug: CSS/hyphens
  • Revision title: hyphens
  • Revision id: 26620
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment new page; see bug 253317; page created, 291 words added

Revision Content

{{ CSSRef() }}

{{ SeeCompatTable() }}

Summary

Th hyphens property tells the browser how to go about splitting words to improve the layout of text when line-wrapping.

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.
  • {{ Xref_cssinitial() }}: manual
  • Applies to: all elements
  • {{ Xref_cssinherited() }}: yes
  • Percentages: n/a
  • Media: {{ Xref_cssvisual() }}
  • {{ Xref_csscomputed() }}: as specified

Syntax

hyphens:  none | manual | auto

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 {{ anch("Suggesting line break opportunities") }} for details.
auto
The browser is free to automatically break words at appropriate hyphenation points, following whatever rules it chooses to use. Suggested line break opportunities, as covered in {{ anch("Suggesting line break opportunities") }}, should be preferred over automatically selecting break points whenever possible.

Suggesting line break opportunities

There are two Unicode character that can be 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 suggests a place where the browser might choose to break the word if necessary.

Examples

 

Specifications

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support {{ CompatUnknown() }} {{ CompatGeckoDesktop("6.0") }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{ CompatUnknown() }} {{ CompatGeckoDesktop("6.0") }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}

See also

{{ Cssxref("content") }}

Revision Source

<p>{{ CSSRef() }}</p>
<p>{{ SeeCompatTable() }}</p>
<h3 name="Summary">Summary</h3>
<p>Th <code>hyphens</code> property tells the browser how to go about splitting words to improve the layout of text when line-wrapping.</p>
<div class="note"><strong>Note:</strong> The rules defining how hyphenation is performed are not explicitly defined by the specification, so the exact hyphenation may vary from browser to browser.</div>
<ul> <li>{{ Xref_cssinitial() }}: <code>manual</code></li> <li>Applies to: all elements</li> <li>{{ Xref_cssinherited() }}: yes</li> <li>Percentages: n/a</li> <li>Media: {{ Xref_cssvisual() }}</li> <li>{{ Xref_csscomputed() }}: as specified</li>
</ul>
<h3 name="Syntax">Syntax</h3>
<pre class="eval">hyphens:  none | manual | auto
</pre>
<h3 name="Values">Values</h3>
<dl> <dt><code>none</code></dt> <dd>Words are not broken at line breaks, even if characters inside the words suggest line break points. Lines will only wrap at whitespace.</dd> <dt><code>manual</code></dt> <dd>Words are broken for line-wrapping only where characters inside the word suggest line break opportunities. See {{ anch("Suggesting line break opportunities") }} for details.</dd> <dt><code>auto</code></dt> <dd>The browser is free to automatically break words at appropriate hyphenation points, following whatever rules it chooses to use. Suggested line break opportunities, as covered in {{ anch("Suggesting line break opportunities") }}, should be preferred over automatically selecting break points whenever possible.</dd>
</dl>
<h3>Suggesting line break opportunities</h3>
<p>There are two Unicode character that can be used to manually specify potential line break points within text:</p>
<dl> <dt>U+2010 (HYPHEN)</dt> <dd>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.</dd> <dt>U+00AD (SHY)</dt> <dd>An invisible, "soft" hyphen. This character is not rendered visibly; instead, it suggests a place where the browser might choose to break the word if necessary.</dd>
</dl>
<h3 name="Examples">Examples</h3>
<pre class="eval"> </pre>
<h3>Specifications</h3>
<ul> <li><a class=" external" href="http://www.w3.org/TR/css3-gcpm/#hyphenation" title="http://www.w3.org/TR/css3-gcpm/#hyphenation">CSS 3 Generated content: hyphens</a></li>
</ul>
<h3 name="Browser_compatibility">Browser compatibility</h3>
<p>{{ CompatibilityTable() }}</p>
<div id="compat-desktop">
<table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Chrome</th> <th>Firefox (Gecko)</th> <th>Internet Explorer</th> <th>Opera</th> <th>Safari</th> </tr> <tr> <td>Basic support</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatGeckoDesktop("6.0") }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> </tr> </tbody>
</table>
</div>
<div id="compat-mobile">
<table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Android</th> <th>Firefox Mobile (Gecko)</th> <th>IE Mobile</th> <th>Opera Mobile</th> <th>Safari Mobile</th> </tr> <tr> <td>Basic support</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatGeckoDesktop("6.0") }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> </tr> </tbody>
</table>
</div>
<h3 name="See_also">See also</h3>
<p>{{ Cssxref("content") }}</p>
Revert to this revision