属性定义及使用说明
word-wrap属性允许长的内容可以自动换行。
| 默认值: | normal |
|---|---|
| 继承: | yes |
| 版本: | CSS3 |
| JavaScript 语法: | object.style.wordWrap=”break-word” |
语法
word-wrap: normal|break-word;| 值 | 描述 |
|---|---|
| normal | 只在允许的断字点换行(浏览器保持默认处理)。 |
| break-word | 在长单词或 URL 地址内部进行换行。 |
浏览器支持
表格中的数字表示支持该属性的第一个浏览器版本号。
| 属性 | 谷歌 | IE | 火狐 | 苹果 | opera |
|---|---|---|---|---|---|
| word-wrap | 4.0 | 5.5 | 3.5 | 3.1 | 10.5 |
实例
指定如果足够长得话,应该换行:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Web176教程网(web176.com)</title>
<style>
p.test
{
width:11em;
border:1px solid #000000;
word-wrap:break-word;
}
</style>
</head>
<body>
<p class="test"> This paragraph contains a very long word: thisisaveryveryveryveryveryverylongword. The long word will break and wrap to the next line.</p>
</body>
</html>作者:terry,如若转载,请注明出处:https://www.web176.com/css3textpro/5139.html
支付宝
微信