我有以下标记:静态元素:绝对
<html>
<body style="margin:0;padding:0">
<div>
<div style="border:3px solid red; width:70%; position:absolute; left:2.5%">Left</div>
<div style="border:3px solid blue; width:25%; position: absolute; left:72.5%">Right</div>
<div style="border:3px solid black; width:95%; margin: 0 auto">Bottom</div>
</div>
</body>
</html>
我想在这里实现为三米的div这样奠定了:
+---------------------------+--------+
|Left |Right |
+---------------------------+--------+
|Bottom |
+------------------------------------+
然而,我的标记的“底部”div与“左”&“底部”重叠。
我应该如何设计这3个元素来达到这个效果?
请注意,“底部”不是页面上的最后一个元素。我只是简单地将“左”和“右”放在一行中,页面流从下面的行继续进行默认定位。
编辑:除了公认的答案...如果你没有静态的高度或出于某种原因不想硬编码,也可以达到类似的效果:
<div style="border:3px solid red; width:70%; position:absolute; left:2.5%">Left</div>
<div style="border:3px solid blue; width:25%; margin-left:72.5%">Right</div>
<div style="border:3px solid black; width:95%; margin: 0 auto">Bottom</div>
“底部”div与“左”和“底”部分重叠。 ......'底部'div与自身**重叠? –