我们正在使用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