CSS3 word-wrap
Property
Topic: CSS3 Properties ReferencePrev|Next
Description
The word-wrap
CSS property specifies the line breaks within the word in order to prevent the overflow when a word is too long to fit within the content area of the element.
The following table summarizes the usages context and the version history of this property.
Default value: | normal |
---|---|
Applies to: | All elements |
Inherited: | yes |
Animatable: | No. See animatable properties. |
Version: | New in CSS3 |
Syntax
The syntax of the property is given with:
The example below shows the word-wrap
property in action.
Example
Try this code »p {
width: 200px;
background: #90ee90;
word-wrap: break-word;
}
Property Values
The following table describes the values of this property.
Value | Description |
---|---|
normal |
Lines may only break at normal word break points. This is default value. |
break-word |
Force an unbreakable word to wrap in a new line in order to prevent overflow, if there are no acceptable break points in the line. |
initial |
Sets this property to its default value. |
inherit |
If specified, the associated element takes the computed value of its parent element word-wrap property. |
Browser Compatibility
The word-wrap
property is supported in all major modern browsers.
Basic Support—
|
Further Reading
See tutorial on: CSS Text.
Related properties: word-break
, white-space
, text-overflow
.