CSS文本-表格单元格中的溢出?我想使用CSStext-overflow在表格单元格中,如果文本太长,不能放在一行上,它将用省略号剪辑,而不是包装到多行。这个是可能的吗?我试过这个:td {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;}但white-space: nowrap似乎使文本(及其单元格)不断向右展开,将表的总宽度推到容器的宽度之外。但是,如果没有它,当文本到达单元格的边缘时,将继续换行到多行。
3 回答
慕姐4208626
TA贡献1852条经验 获得超7个赞
max-width
td
td { max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
max-width
max-width: 0;
width: 100%;
table { width: 100%;}td { max-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}td.columnA { width: 30%;}td.columnB { width: 70%;}
<!--[if IE]> <style> table { table-layout: fixed; width: 100px; } </style> <![endif]-->
- 3 回答
- 0 关注
- 749 浏览
相关问题推荐
添加回答
举报
0/150
提交
取消