您现在的位置是:首页 > 电脑技术查询 > web开发

为什么这样不能换行?解决方法

编辑:chaxungu时间:2022-10-02 23:20:51分类:web开发

为什么这样不能换行?
<html>
<head>
<script language=javascript>
function paixu()//排序函数
{
document.getElementById( "wrap ").innerHTML+= "qwwsaasaww ";
}
</script>
</head>
<body>
<div id= "wrap " style= "white-space:normal; width:200px; "> 正常文字的换行(亚洲文字和非亚洲文字)元素拥有默认的white-space:normal,当定义 </div>
<input value= "为什么这样不能换行? " type= "button " onClick= "paixu() ">
</body>
</html>

------解决方案--------------------
word-break: break-all;

word-wrap: break-word;

以上两句都管换行!

white-space:normal 管单词间的空格,不管换行!!!