在做表格的时候遇到两个问题:表格宽度设置和超出文字省略号显示
1.表格宽度
需设置table的样式:table-layout:fixed;width: 100%;
然后在首行(th)设置宽度(最后一列不设置)。
主要是首行(th)设置宽度才有效
2.超出文字省略号显示
设置td的样式:overflow: hidden;text-overflow: ellipsis;white-space: nowrap;
在做表格的时候遇到两个问题:表格宽度设置和超出文字省略号显示
1.表格宽度
需设置table的样式:table-layout:fixed;width: 100%;
然后在首行(th)设置宽度(最后一列不设置)。
主要是首行(th)设置宽度才有效
2.超出文字省略号显示
设置td的样式:overflow: hidden;text-overflow: ellipsis;white-space: nowrap;