word-break文本换行

建议使用word-break:keep-all,不拆分单词
<title>菜鸟教程(runoob.com)</title>
<style> 
p.test1
{
	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 paragraph contains some text. This line will-break-at-hyphenates.</p>
<p class="test2"> This paragraph contains some text: The lines will break at any character.</p>

<p><b>注意:</b>  word-break 属性不兼容 Opera.</p>

</body>
</html>

代码效果如下

猜你喜欢

转载自1035040092.iteye.com/blog/2351594