word

属性规定自动换行的处理方法。

在恰当的断字点进行换行:

p.test {word-break:hyphenate;}

定义和用法

word-break 属性规定自动换行的处理方法。

提示:通过使用 word-break 属性,可以让浏览器实现在任意位置的换行。

默认值:normal
继承性:yes
版本:CSS3
JavaScript 语法:object.style.wordBreak="keep-all"

语法

word-break: normal|break-all|keep-all;
描述
normal使用浏览器默认的换行规则。
break-all允许在单词内换行。
keep-all只能在半角空格或连字符处换行。
<!DOCTYPE html>
<html>
<head>
<style> 
p.test1
{
width:11em; 
border:1px solid #000000;
word-break:hyphenate;
}p.test2
{
width:11em; 
border:1px solid #000000;
word-break:break-all;
}
</style>
</head>
<body><p class="test1">This is a veryveryveryveryveryveryveryveryveryvery long paragraph.</p>
<p class="test2">This is a veryveryveryveryveryveryveryveryveryvery long paragraph.</p><p><b>注释:</b>目前 Opera 不支持 word-break 属性。</p></body>
</html>