table中的td内容过长显示为固定长度,多余部分用省略号代替

如何使td标签中过长的内容只显示为这个td的width的长度,之后的便以省略号代替。

table 中必须设置属性:

table-layout: fixed;

然后给 td 设置:

white-space:nowrap;
overflow:hidden;
text-overflow: ellipsis;

就可以实现了。

原文地址:https://www.cnblogs.com/intangible/p/9719813.html