文字适应DIV

今天突然碰到了一个奇怪的问题  那就是对于纯数字和英文字母  文字多了会超出div  且即使是设置了height:auto overflow-y:auto 也不管用

只是在x轴上出现滚动条   不论用什么高度自适应 高度都是无法自己改变的呢...

check this   http://stackoverflow.com/questions/2920114/how-to-auto-adjust-the-div-height-according-to-content-in-it

解决方法是   实际上不是div高度自适应   而是文字到div边缘自动换行

参考 http://www.blueidea.com/tech/web/2006/3469.asp

body>div.wrapper2{
100px;
word-break:break-all;
overflow:auto;
}   

<div class="wrapper2">aaaaaaaaaaaaaaxxxxxxxxxxxxxaaaaaaaaaxxxxxxxxxx</div>

原文地址:https://www.cnblogs.com/cart55free99/p/3556729.html