abi*_*son 2 javascript css jquery css3 css-tables
所以我试图让溢出属性为td中的div工作.但是,我以百分比的形式设置td的宽度.因此,我不能用固定的像素数设置div的宽度(在td内),因为我不会事先知道它.
<table id="table">
<thead>
<tr>
<th>column 1</th>
<th>column 2</th>
</tr>
</thead>
<tbody>
<tr>
<td><div class="cell">Aaaaaaaaaaaaaabbbbbbbbba</div></td>
<td><div class="cell">bbbbbbbbbbbbbaaaaaaaaaaabb</div></td>
</tr>
</tbody>
</table>?
#table {
width:100px !important;
}
th {
width:16% !important;
border: 1px solid black;
}
.cell{
width:100%;
overflow: hidden;
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
-webkit-text-overflow: ellipsis;
white-space: nowrap;
}
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?!
非常感谢!
您可能想尝试添加以下css规则:
#table{
table-layout:fixed;
overflow:hidden;
white-space: nowrap;
}
Run Code Online (Sandbox Code Playgroud)
请在这篇文章中查看更多内容.
| 归档时间: |
|
| 查看次数: |
4132 次 |
| 最近记录: |