table中文字过长使用省略号

1.设置table固定布局,否则自适应布局会不受控制

table{

  table-layout: fixed;

}

2.设定td宽度占比

<table>
<col width="5%">
<col width="20%">
<col width="30%">
<col width="15%">
<col width="15%">
<col width="15%">
<thead>
</thead>
 
3.设置指定td文字过长省略号表示
table td.name {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
posted @ 2017-05-10 10:22  善未易明  阅读(2454)  评论(0)    收藏  举报