English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
word-Break attribute usage and example
The break CSS attribute is used to specify how to wrap within words.
The following table provides usage instructions and version history for this attribute, as well as its usage syntax in JavaScript scripts. | normal |
---|---|
Default value: | Applicable to: |
All elements | Inheritance: |
Yes | Can be animated:No. Animation properties. |
Version: | CSS3new feature |
JavaScript syntax: | object.style.wordBreak="break-all" |
The syntax of this attribute is as follows:
word-break: normal | break-all | keep-all | initial | inherit
The following examples demonstrate how to use word-break attribute.
p { width: 150px; background: #90ee90; word-break: break-all; }Test and see‹/›
The following table describes the values of this attribute.
Value | Description |
---|---|
normal | Words are wrapped according to their usual rules. |
break-all | Allow wrapping within words. |
keep-all | Prevent spaces between paired letters. Can only be wrapped at half-width spaces or hyphens. |
initial | Set this property to its default value. |
inherit | If specified, the associated elements will adopt the word of their parent element.-Break attribute values. |
word-Browser compatibility of the break attribute; the numbers in the table below indicate the minimum browser version that supports this attribute; all mainstream browsers support this attribute.
|
Please refer to the following tutorials:CSS Text.
Related properties:word-wrap,white-space,text-overflow.