【发布时间】:2011-02-02 22:37:14
【问题描述】:
我遇到了垂直对齐问题。我有 2 个 div。第一个具有自动高度(取决于浏览器大小),另一个具有固定高度并位于页面底部。另外,第二个 div 需要边距。
我想做的一个确切的例子:
http://img199.imageshack.us/img199/9569/79106387.jpg
我试过了:
<html>
<body>
<style>
* { margin: 0; padding: 0; }
body { background: #a7daf6; }
</style>
<div style="width:200px; height:100%; position:absolute; background:#000; opacity:0.6"> </div>
<div style="width:200px; height:40px; position:absolute; background:#eee; bottom:0; opacity:0.6"> </div>
</body>
</html>
但我不能给第二个 div 留出余量。有任何想法吗?
【问题讨论】:
-
问题一定消失了?
-
您在申请
margin-top时希望看到什么?
标签: html css fullscreen vertical-alignment