我們正在使用div容器設計一個簡單的SMS列表視圖。基本的想法是讓這個頁面適用於不同的手機屏幕尺寸。我不想加載像bootstrap這樣的第三方腳本。混淆哪個div需要溢出隱藏
我成功地設計了頁面,它在http://jsfiddle.net/my9Lt7jf/可用。它看起來不錯,但是如果我將瀏覽器縮小到更小的寬度,那麼容納名稱和手機號碼的div容器就會換行並分解到下一行。這同樣適用於短信。當瀏覽器縮小到更小的寬度時,我不想將它帶到下一行。相反,我希望文本可以隱藏3個點,這樣它就可以在最後以3個點顯示在一行中。
代碼
.his_outercontainer{
width:100%;
border:1px solid #cccccc;
height:50px;
display: table;
}
.his_leftcontainer{
width:30px;
padding:3px;
display: table-cell;
vertical-align: middle;
}
.his_middlecontainer{
padding:3px;
display: table-cell;
}
.his_rightcontainer{
padding:3px;
display: table-cell;
text-align:right;
}
.his_mobilenumber{
font-weight:bold;
}
.his_textmessage{
overflow:hidden;
padding-top:3px;
}
.his_senttime{
font-style:italic;
}
.his_flagindicator{
padding-top:3px;
}
HTML代碼
<div class='his_outercontainer'>
<div class='his_leftcontainer'>
<input type='checkbox' />
</div>
<div class='his_middlecontainer'>
<div class='his_mobilenumber'>
Ramkumar <+911234567890>
</div>
<div class='his_textmessage'>
Happy birthday to you Mr.John
</div>
</div>
<div class='his_rightcontainer'>
<div class='his_senttime'>
31st Oct 10:45 pm
</div>
<div class='his_flagindicator'>
<img src='green.png' />
</div>
</div>
</div>
它的樣子是如下
但是應該如何如下
的CSS 0
嘗試使用http:// www.w3schools.com/cssref/css3_pr_text-overflow.asp – SkelDave 2014-11-03 21:18:22