CSS Property word-wrap








The word-wrap property wraps long words to the next line.

Summary

Initial value
normal
Inherited
yes
CSS Version
CSS3
JavaScript syntax
object.style.wordWrap="break-word"
Animatable
Yes

CSS Syntax

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

Property Values

normal
Break words at allowed break points
break-word
break unbreakable words

Browser compatibility

word-wrap Yes Yes Yes Yes Yes




Example

<!DOCTYPE html>
<html>
<head>
<style> 
p.test {<!--   w  w w  . j a v  a2 s .c  om-->
    width: 11em; 
    border: 1px solid #000000;
    word-wrap: break-word;
}
</style>
</head>
<body>

<p class="test"> this is a test: thisisaveryveryveryveryveryverylongword. 
</p>

</body>
</html>

Click to view the demo