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

CSS Basic Tutorial

CSS Box Model

CSS3Basic Tutorial

CSS Reference Manual

CSS @rules (RULES)

CSS word-wrap (auto-wrap)

CSS word-wrap propertyUsed forBreak long words and automatically wrap to the next line. When an unbreakable string is too long to fit in the containing box, this property is used to prevent overflow.

CSS Text Wrapping Values

ValueDescription
normalThis property is only used to break words at allowed breakpoints.
break-wordIt is used to break unbreakable words.
initialIt is used to set this property to its default value.
inheritIt inherits this property from its parent element.

CSS Auto-Wrap Online Example

<!DOCTYPE html>
<html>
<head>
<style> 
p.test {
    width: 11em;
    background-color: #ff9900; 
    border: 1px solid #ffffff;
    padding:10px;
    word-wrap: break-word;
}
</style>
</head>
<p class="test"> In this paragraph, there is a very long word:
 <p class="test"> In this paragraph, there is a very long word: iamsooooooooooooooooooooooooooooooooooooolongggggggggggggggg. The long word will break and wrap to the next line.</p>/p>
</html>
Test see‹/›

Output:

In this paragraph, there is a very long word: iamsooooooooooooooooooooooooooooooooooooolongggggggggggggggg.long This word will break and wrap to the next line.