最大高度不能在桌子上工作
问题描述:
在我的网站上,在某些页面上,有一个表格列出了一些信息。如果有6个项目要显示,那么包含信息的表格单元格应该有一个滚动条 - 单元格不应该展开。最大高度不能在桌子上工作
所以,我有以下布局:
<table style="overflow-y:scroll"> //this contains multiple boxes for different topics
<tr style="overflow-y:scroll;max-height:200px;"> //this contains one topic of info
<td style="overflow-y:scroll;max-height:200px;"> //This contains one topic of info
<table style="overflow-y:scroll;max-height:200px;"> //contains one topic with several items
<tr><td>OneItem</td></tr>
<tr><td>AnotherItem</td></tr> (and say, this goes on for 10 items)
</table>
</td>
</tr>
//the outermost <tr> would repeat itself here, say 5 times for each of a few different topics.
</table>
但是,这不幸的是,结果在一个盒子里是较大的伸展不断为每个新产品加入。如果它有足够的物品。 (当更新完成时,我将使用CSS和overflow-y:auto
,但是为了更好的测试目的,我正在使用它)。
我最初只用一个外表尝试它,但布局比我在此处显示的稍微复杂一点,所以单个外表不会根据需要显示。
但我需要的是知道如何使最大高度防止<tr>
,<td>
或<table>
伸展。
任何帮助,非常感谢。
答
我添加了一个<div
>最外层<td>
内:
<table> //this contains multiple boxes for different topics
<tr> //this contains one topic of info
<td> //This contains one topic of info
<div style="overflow-y:scroll;max-height:200px;">
<table> //contains one topic with several items
我在G-Chrome和Firefox测试。 – Jakar 2012-03-17 20:14:39