English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

CSS Reference Manual

CSS @rules (RULES)

Comprehensive List of CSS Attributes

Version:3 word-size Attribute

word-wrap Attribute Usage and Example

wrap CSS Attribute Specifies to prevent overflow, allowing long content to automatically wrap.

The following table provides usage instructions and version history of this attribute, as well as its usage syntax in JavaScript scripts.normal
Default Value:Applicable To:
All ElementsInheritance:
YesAnimatable:No. Please see.
Animation Attribute Version:3CSS
New Feature of JavaScript Syntax:object.style.wordWrap="break-word"

word-wrap Usage Syntax

The syntax of this attribute is as follows:

word-wrap: normal | break-word | initial | inherit

The following examples demonstrate how to use word-wrap Attribute.

  p {
   width: 200px;
   background: #90ee90;
   word-wrap: break-word;
  }
Test to see‹/›

Attribute Values

The following table describes the values of this attribute.

ValueDescription
normalOnly wrap at allowed hyphenation points (browsers keep the default processing). This is the default value.
break-wordIf there are no acceptable breakpoints in the line, force the non-breakable words to wrap to prevent overflow.
initialSet this attribute to its default value.
inheritIf specified, the associated elements adopt the word wrap of their parent element.-wrap Attribute Values.

Browser Compatibility

word-Browser Compatibility of the wrap Attribute; the numbers in the table below represent the minimum browser version that supports this attribute; all mainstream browsers support this attribute.

  • Firefox 3.5+

  • Google Chrome1+

  • Internet Explorer 5.5Above

  • Apple Safari 1+

  • Opera 10.5+

Further Reading

Please refer to the following tutorials:CSS Text.

Related Attributes:word-break,white-space,text-overflow.