相关疑难解决方法(0)

在TD中使用位置相对/绝对值?

我有以下代码:

<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>
Run Code Online (Sandbox Code Playgroud)

这根本不起作用.出于某种原因,在TD上没有读取位置:相对命令,并且通知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>
Run Code Online (Sandbox Code Playgroud)

但是,这会产生新问题.由于表格单元格内容的高度是可变的,因此通知DIV并不总是位于单元格的底部.如果表格单元格超出60px标记,但其他单元格都没有,那么在其他单元格中,通知DIV将向下移动60px,而不是在底部.

html position html-table

105
推荐指数
2
解决办法
13万
查看次数

标签 统计

html ×1

html-table ×1

position ×1