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

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

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>

word-break 换行

相关文章:

  • 2022-12-23
  • 2021-12-08
  • 2021-08-24
  • 2022-12-23
  • 2021-06-26
  • 2021-06-02
猜你喜欢
  • 2022-12-23
  • 2022-02-21
  • 2021-12-18
  • 2021-08-07
  • 2022-12-23
  • 2022-01-19
  • 2022-01-07
相关资源
相似解决方案