认识弗雷德。他是一张桌子:
<table border="1" style="width: 100%;">
<tr>
<td>This cells has more content</td>
<td>Less content here</td>
</tr>
</table>
弗雷德的公寓有一个改变大小的奇怪习惯,所以他学会了隐藏一些内容,以免推倒所有其他单元并把惠特福德夫人的客厅推向遗忘:
<table border="1" style="width: 100%; white-space: nowrap; table-layout: fixed;">
<tr>
<td style="overflow: hidden; text-overflow: ellipsis">This cells has more content</td>
<td style="overflow: hidden; text-overflow: ellipsis">Less content here</td>
</tr>
</table>
这可行,但 Fred 有一种挥之不去的感觉,如果他的右单元格(他昵称 Celldito)放弃一点空间,他的左单元格在大多数情况下都不会被截断。你能拯救他的理智吗?
总结:表格的单元格如何才能均匀地溢出,并且只有当它们全部放弃所有空白时?
<table border="1" style="width: 100%;">
<colgroup>
<col width="100%" />
<col width="0%" />
</colgroup>
<tr>
<td style="white-space: nowrap; text-overflow:ellipsis; overflow: hidden; max-width:1px;">This cell has more content.This cell has more content.This cell has more content.This cell has more content.This cell has more content.This cell has more content.</td>
<td style="white-space: nowrap;">Less content here.</td>
</tr>
</table>
http://jsfiddle.net/7CURQ/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)