Use word-wrap Property to allow Line Breaks in the Middle of Words
By Stephen Bucaro
If a long word is in a containing element that has a set width, since the word has
no convienent spaces for a natural line break, the word will extend outside the
containing element as shown below.
Pneumonoultramicroscopicsilicovolcanoconiosis is a lung disease caused by inhaling very fine ash and sand dust.
To allow line breaks in the middle of words, add the CSS word-wrap property and
set its value to break-word. An example of the code for this is shown below:
<div style="width:200px; border:1px solid #000000; word-wrap:break-word;">
Pneumonoultramicroscopicsilicovolcanoconiosis is a lung disease caused by inhaling very fine ash and sand dust.
The default value of the word-wrap property is normal.
More CSS Quick Reference: • CSS Units of Measurement • CSS background-origin Positions Background • Set an Element's Clipping • Set the Font Slant • Use word-wrap Property to allow Line Breaks in the Middle of Words • Set the Text Case • Set the Border Color • Set the Word Spacing • Set an Element's Float • Set The Cursor Style
|