html p元素里面的内容如果是数字和字母,为什么不能自动换行呢?

汉字的话就可以

<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>无标题文档</title>
    <script src="jquery-1.9.1.min.js"></script>
    <style>

    </style>
    <script>


    </script>
</head>

<body>
    <p style="width:20px;height:100px;background-color:#069; word-wrap: break-word;">111111111111111111111111111111111111</p>
    <p style="width:20px;height:100px;background-color:#069;">你好你好你好你好你好你好你好你好你好你好</p>
</body>
</html>

word-wrap : normal | break-word

参数:

normal :  允许内容顶开指定的容器边界
break-word :  内容将在边界内换行。如果需要,词内换行(word-break)也行发生

温馨提示:答案为网友推荐,仅供参考
第1个回答  2014-07-14
<p style="width:20px;height:100px; background:#0066CC;word-break:break-all;">11111111111111111111111111111111111111111111111111111111111111111111111111111</p>
相似回答