CSS定位在HTML表格内部

CSS定位在HTML表格内部

本文介绍了CSS定位在HTML表格内部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我觉得这应该是一个没有脑子,但显然我缺少的东西...

I feel like this should be a no brainer, but clearly I'm missing something...

我被困在一个HTML表的页面上,并且需要绝对定位一个在表内部呈现的元素,以便在应用DHTML显示时可以正确显示。

I'm stuck with an HTML table on a page, and need to absolutely position an element that is rendered inside of the table so that it can display properly when we apply DHTML to show it.

我试图绝对定位它相对于一个表行的底部,但浏览器(FF和IE)不会相对于该行渲染它。

I tried absolutely positioning it relative to the bottom of a table row, but the browser (FF and IE) will not render it relative to the row. Instead it takes the positioning relative to the next parent above the row that has relative positioning.

基本上是:

<table>
<tr class="aRelativelyPositionedClass">
    <td>
         <div class="anAbsolutelyPositionedClass">stuff I want to absolutely position</div>
    </td>
</tr>
</table>

是否可以相对于行放置内部div?或者是我缺少表格的HTML问题?

Is it possible to position the inner div relative to the row? Or is there an HTML issue I'm missing with tables?

推荐答案

我不认为你可以相对于

您应该能够通过设置样式的位置来定位它相对于单元格:relative 使单元格成为图层。仍然单元格不是一个独立的元素,所以你可能不得不在单元格中另一个div,并使一个图层,以使其正常工作。

You should be able to position it relative to the cell by setting the style position:relative on the cell to make it a layer. Still the cell is not an independent element, so you may have to put another div in the cell and make that a layer instead to make it work properly.

有问题的布局当你结合它与其他技术...或许你应该考虑删除表altogehter ...)

(Tables are problematic for layout when you combine it with other techniques... Perhaps you should consider removing the table altogehter...)

这篇关于CSS定位在HTML表格内部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-16 04:32