4 回答

TA貢獻83條經驗 獲得超16個贊
css 屬性: word-break 和 word-wrap 可以幫助你
word-break:?break-all; word-wrap:?break-word;

TA貢獻1條經驗 獲得超0個贊
你的問題是你輸入的內容如果過長,不會自動換行,直接在div外面顯示了。這里面的問題是position:absolute;定位就脫離了文檔流,你的內容和這個定位就沒有在同一個文檔流里面。所以就不受這個定位的影響了。據我所知,如果要左邊寬度固定,右邊自適應。左邊給了寬度后用margin-left給一個和寬度一樣的負值。大概事例如下。
<div?id="container">
<div?id="left"?class="aside">Left?Sidebar</div>
<div?id="content"?class="section">Main?Content</div>
</div>
<style?type="text/css">
*{margin:?0;padding:?0;}
#container?{
overflow:?hidden;
}
?
#left?{
background:?#ccc;
float:?left;
width:?200px;
margin-bottom:?-99999px;
padding-bottom:?99999px;
?
}
?
#content?{
background:?#eee;
margin-left:?200px;/*==此值等于左邊欄的寬度值==*/
margin-bottom:?-99999px;
padding-bottom:?99999px;
}
#left,
#content?{
min-height:?200px;
height:?auto?!important;
height:?200px;
}
</style>
添加回答
舉報