0

我有这个 HTML

<div style="position: relative;">

<div style="top:0">

</div>

<div style='position: absolute; bottom:0; margin-bottom:0px;'>


</div>

</div>

这段代码在 IE 上工作得非常好,但在其他浏览器上,两个内部 div 重叠,我不能给外部 div 任何指定的高度。

4

1 回答 1

0

您不需要绝对定位:

<div style="position: relative;">

    <div style="background:black;">
        test
    </div>

    <div style='background:red;'>
        test    
    </div>

</div>

见工作小提琴

于 2013-03-08T10:30:19.287 回答