Use text-overflow: ellipsis
. You will need to fix the width of the cells and prevent line wrapping:
td {
width: 100px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
EDIT: actually this won't work. It seems you need a container div to apply the styles to:
<table>
<tr>
<td><div>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</div</td>
(snip)
And then:
td div {
width: 100px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
EDIT 2 Ah there is a way, but only if you use table-layout: fixed
:
table {
table-layout: fixed;
width: 100px;
}
td {
white-space: nowrap;
overflow: hidden; /* <- this does seem to be required */
text-overflow: ellipsis;
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…