码迷,mamicode.com
首页 > 其他好文 > 详细

table中td内容过长 省略号显示

时间:2017-01-12 18:45:54      阅读:294      评论:0      收藏:0      [点我收藏+]

标签:样式   显示   hidden   webkit   text   代码   boot   css   自动   

首先设置 css样式:

    table { table-layout: fixed;}

HTML中的table代码:

<tr>
<th class="col-md-1">用户ID</th>
<th class="col-md-1">用户名</th>
<th class="col-md-1">联系电话</th>
<th class="col-md-1">邮箱</th>
<th class="col-md-4">描述 </th>
<th class="col-md-2">添加时间</th>
<th class="col-md-2">操作</th>
</tr>
【对于bootstrap应该设置th的固定宽度】

设置td超过固定宽度自动显示为省略号:
table tr td {
overflow:hidden;
white-space:nowrap;
text-overflow:ellipsis;
-o-text-overflow:ellipsis;
-moz-text-overflow: ellipsis;
-webkit-text-overflow: ellipsis;
}

table中td内容过长 省略号显示

标签:样式   显示   hidden   webkit   text   代码   boot   css   自动   

原文地址:http://www.cnblogs.com/miny-simp/p/6279185.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!