word-wrap
word-wrap 属性允许长的内容可以自动换行。
语法
word-wrap: normal|break-word;
值
值 | 描述 |
---|---|
normal | 只在允许的断字点换行(浏览器保持默认处理)。 |
break-word | 在长单词或 URL 地址内部进行换行。 |
例子
HTML
<p class="test"> This paragraph contains a very long word: thisisaveryveryveryveryveryverylongword. The long word will break and wrap to the next line.</p>
CSS
p.test { width:11em; border:1px solid #000000; word-wrap:break-word; }
执行结果
This paragraph contains a very long word: thisisaveryveryveryveryveryverylongword. The long word will break and wrap to the next line.