不确定这是否有帮助,但我发现了这个有趣的技巧。似乎适用于 IE 8、IE 9、FireFox 3.6、FireFox 4 和 Safari 5(至少适用于 Windows)。
<div name="test1" id="test1" style="position:absolute; left:0px; top:95px; width:50%; height:300px; z-index:5; background: #7BCDC9;">
This starts at the left edge, and goes all the way to the middle of the screen.
</div>
<div name="test2" id="test2" style="position:absolute; left:50%; top:95px; width:50%; height:300px; z-index:5; background: #4D3627;">
Starts in the middle, and goes all the way to the right edge.
</div>
然后,使用 z-index:10 将居中的 div 添加到顶部(使用您喜欢的方法);使其“在”其他元素之上。