CSS overflow-wrap Property
Example
.example1 {
overflow-wrap: normal;
}
.example2 {
overflow-wrap: break-word;
}
.example3 {
overflow-wrap: anywhere;
}
This div contains a very long word: thisisaveryveryveryveryveryverylongword. The long word will break and wrap to the next line.
Meaning
The overflow-wrap property applies to inline elements, setting whether the browser should insert line breaks within an otherwise unbreakable string to prevent text from overflowing its line box.
Note: In contrast to word-break, overflow-wrap will only create a break if an entire word cannot be placed on its own line without overflowing.
Default value: | normal |
Inherited: | Yes |
Animatable: | No |
Version: | CSS3 |
JavaScript syntax: |
|
Standard Syntax
overflow-wrap: normal|anywhere|break-word|initial|inherit|revert|revert-layer|unset;
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Status
Property Values
The following table describes the values of this property.
Value | Description |
---|---|
normal | This is default value. Specifies that the long words will not break, even if they overflow the container. |
anywhere | Specifies that the long words will break if they overflow the container. |
break-word | Specifies that the long words will break if they overflow the container. |
initial | Sets this property to its default value. |
inherit | If specified, the associated element takes the computed value of its parent element animation-delay property. |
revert | Reverts the cascaded value of the property from its current value to the value the property |
revert-layer | Rollback styles to the ones specified in previous cascade layers. |
unset | Resets a property to its inherited value if the property naturally inherits from its parent, and to its initial value if not. |
Default CSS Property Values
selectors {
overflow-wrap: normal;
}