首先设置表格的样式table-layout:"fixed"(这步是前提)
table {width:100%;table-layout:fixed;}
然后设置tr的宽高
table tr {width:100%;height:30px;}
最后设置td
table tr td {text-overflow:ellipsis;white-space:nowrap;overflow:hidden;}
这样子就ok了!!!
作者:coder7
链接:https://www.jianshu.com/p/69d2d3e63958
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。