table中td会随着里面的内容伸缩,设置其width样式并没有效果。这个时候需要下面的CSS可以实现。
首先是设置table
.table {table-layout:fixed;}
其次是td
.table td { overflow: hidden; white-space: nowrap; text-overflow: ellipsis;}