【发布时间】:2011-06-01 16:01:02
【问题描述】:
我有以下代码:
<td style="position: relative; min-height: 60px; vertical-align: top;">
Contents of table cell, variable height, could be more than 60px;
<div style="position: absolute; bottom: 0px;">
Notice
</div>
</td>
这根本不起作用。出于某种原因,没有在 TD 上读取 position:relative 命令,并且通知 DIV 被放置在我页面底部的内容容器之外。我试图将 TD 的所有内容放入一个 DIV 中,例如:
<td>
<div style="position: relative; min-height: 60px; vertical-align: top;">
Contents of table cell, variable height, could be more than 60px;
<div style="position: absolute; bottom: 0px;">
Notice
</div>
</div>
</td>
但是,这会产生一个新问题。由于表格单元格内容的高度是可变的,因此通知 DIV 并不总是位于单元格的底部。如果表格单元格超出了 60px 标记,但其他单元格都没有,那么在其他单元格中,通知 DIV 位于 60px 下方,而不是底部。
【问题讨论】:
-
有使用表的理由吗?我假设其余的表格内容将改变这个单元格的内容。如果需要表格,您可以使用两行顶部与 valign=top 和底部与 valign=bottom
-
如果您使用表格进行布局,我建议您不要这样做。使用表格显示数据很好,但它们不适合布局。
-
它用于日历...所以表格网格是必不可少的:8wayrun.com/events/monthly/1.2011
标签: html position html-table