CSS hyphens Property
Example
Set different hyphenations:
<style>
div.a {
hyphens: none;
}
div.b {
hyphens: manual;
}
div.c {
hyphens: auto;
}
</style>
<body>
<h2>hyphens:
none</h2>
<div class="a">A veryvery­very long word.</div>
<h2>hyphens: manual</h2>
<div class="b">A veryvery­very long
word.</div>
<h2>hyphens: auto</h2>
<div class="c">A
veryvery­very long word.</div>
</body>
Try it Yourself »
Definition and Usage
The hyphens
property defines whether
hyphenation is allowed to create more soft wrap opportunities within a line of
text.
Default value: | manual |
---|---|
Inherited: | yes |
Animatable: | no. Read about animatable |
Version: | CSS3 |
JavaScript syntax: | object.style.hyphens="none" |
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Property | |||||
---|---|---|---|---|---|
hyphens | 55 | 79 | 43 | 17 | 44 |
CSS Syntax
hyphens: none|manual|auto|initial|inherit;
Property Values
Value | Description | Demo |
---|---|---|
none | Words are not hyphenated | Demo ❯ |
manual | Default. Words are only hyphenated at ‐ or ­ (if needed) | Demo ❯ |
auto | Words are hyphenated where the algorithm is deciding (if needed) | Demo ❯ |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |