Normally, line breaks only occur in a space or a hyphen.
When setting word-break
to break-all
,
line breaks can occur between any character.
word-break: normal|break-all|keep-all;
word-break |
Yes | Yes | Yes | Yes | Yes |
<!DOCTYPE html>
<html>
<head>
<style>
p.test1 {<!-- w w w.ja v a2s .co m-->
width: 9em;
border: 1px solid #000000;
word-break: keep-all;
}
p.test2 {
width: 9em;
border: 1px solid #000000;
word-break: break-all;
}
</style>
</head>
<body>
<p class="test1">this is a test. this is a test. this is a test. this is a test.</p>
<p class="test2">this is a teeeeeeeeeeeeeeeeeeeest. this is a teeeeeeeeeest. this is a teeeeeeeeeest. </p>
</body>
</html>