是否有可能创建一个表格,使单元格的高度分布如下所示?
______________________________________
| fixed height |
|____________________________________|
| |
| |
| dynamic height |
| |
|____________________________________|
| fixed height |
|____________________________________|
因此,第一个和最后一个单元格的高度是固定的,中间单元格应该是动态的并可滚动的。
目前我有以下代码,但它不起作用:
<table style="max-height:200px">
<tr>
<td height="30px">First element</td>
</tr>
<tr>
<td>
<!-- Div for scroll functionality if content is too high -->
<div style="overflow:auto">
Dynamic content which needs to be scrolled sometimes
</div>
</td>
</tr>
<tr>
<td height="30px">last element</td>
</tr>
</table>
编辑:这不需要是一个表格,只要中心元素具有动态高度并且可以滚动很重要。
编辑:我知道我可以指定要滚动的元素的高度-那么它就可以工作了。但是我希望元素的高度是动态的。