【发布时间】:2016-06-27 19:48:04
【问题描述】:
我有下表:
.myContainer {
background-color: yellow;
width: 200px;
}
.myTable {
}
.columnA {
max-width: 80px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.columnB {
}
.columnC {
}
<div class="myContainer">
<table class="myTable">
<th>
<tr>
<th>Name</th>
<th>Height</th>
<th>Weight</th>
</tr>
</th>
<tr>
<td class="columnA">Jack Jackman</td>
<td class="columnB">170.000</td>
<td class="columnC">70.000</td>
</tr>
<tr>
<td class="columnA">Smith Smithman</td>
<td class="columnB">180.000</td>
<td class="columnC">80.000</td>
</tr>
</table>
</div>
我需要摆脱固定的max-width: 80px; 为.columnA 而不会失去省略号效果。这样:
- 除外部 Div 外,没有固定宽度。
- 表格与外部 Div 一样宽。
- B 列和 C 列与其内容一样宽(无换行/溢出)
- 在使用“...”处理文本溢出时,A 列占用剩余宽度
【问题讨论】: