我有一个内部有div
的表格单元格。我希望div
溢出表格单元格之外。我怎样才能做到这一点?要清楚,我不希望表格单元格使用div
扩展其高度。下面的代码是我尝试过的,但它不起作用。
HTML:
<table>
<tr class="row">
<td class="cell">
<div class="overflow">Overlow outside of this cell</div>
</td>
</tr>
</table>
CSS:
.row {
height:24px;
overflow:visible;
}
.cell {
overflow:visible;
max-height:24px !important;
}
.overflow {
height:24px;
font-size:12px;
clear:both;
white-space: nowrap;
line-height:16px;
zoom:1;
text-align:left;
overflow:hidden;
}
答案 0 :(得分:10)
如果我找对你,这可能会有所帮助:
HTML:
<table>
<tr class="row">
<td class="cell">
<div class="overflow">Overlow outside of this cell</div>
</td>
</tr>
</table>
CSS:
.row {
height:24px;
overflow:visible;
}
.cell {
overflow:visible;
max-height:24px !important;
border: 1px solid #cccccc;
width:10px;
}
.overflow {
height:24px;
font-size:12px;
line-height:16px;
position:absolute;
}
答案 1 :(得分:0)
.overflow {
height: 100px;
width: 100px !important;
overflow-y: scroll;
}