首先 ,bootstrap中当td内容超过我给的固定宽度时,省略号代替的代码如下:
<table class="table table-bordered">
 <thead>
 <tr>
 <th class="center" style='width:38%;'>商品名称</th>
 <th class="center" style='width:36%;'>详细介绍</th>
 <th class="center" style='width:22%;'>购买数量</th>
 </tr>
 </thead>
 <tbody id="tbody">
 <tr>
 <td>自由行机票享超值优惠</td>
 <td>随心所欲安排行程</td>
 <td>70</td>
 </tr>
 <tr>
 <td>自由行机票享超值优惠</td>
 <td>随心所欲安排行程</td>
 <td>70</td>
 </tr> 
 <tr>
 <td>自由行机票享超值优惠</td>
 <td>随心所欲安排行程</td>
 <td>70</td>
 </tr> 
 </tbody> 
 </table>
.table tbody tr td{
 overflow: hidden; 
 text-overflow:ellipsis; 
 white-space: nowrap; 
 }移动端模拟器显示效果是这样的。不是很舒服,完全没按我给他的宽度显示,全靠内容挤出来的。
 
 
解决方法:
<table class="table table-bordered" style='table-layout:fixed;'>也就是添加样式
table{
 table-layout:fixed;
}效果出现:

table-layout用来显示表格单元格、行、列的算法规则。值 描述
automatic 默认。列宽度由单元格内容设定。 fixed 列宽由表格宽度和列宽度设定。 inherit 规定应该从父元素继承 table-layout 属性的值。
总结
以上所述是小编给大家介绍的bootstrap表格内容过长时用省略号表示的解决方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持!