【发布时间】:2012-01-11 15:11:56
【问题描述】:
我想在不使用百分比或函数(仅 css)的情况下从底部到顶部垂直扩展 DIV。我有两个 div,但只有第二个有定义的高度,所以我必须用我的第一个 div 修复其余空间。
这是我的代码:
<html>
<head>
<style>
#one { position: absolute; width: 100%; background: red; top: 0 }
#two { position: absolute; width: 100%; background: yellow; bottom: 0; height: 200 }
</style>
</head>
<body>
<div id="one">"DIV 1" has to be stucked to "DIV 2"</div>
<div id="two">I wanna "DIV 2" determines the height of "DIV 1"</div>
</body>
</html>
You can put the code here to see what I'm getting
问题是红色的 div 停留在顶部:S
任何帮助将不胜感激,感谢您的宝贵时间! 友好,春波哥兽
【问题讨论】:
-
请使用 jsFiddle 向我们展示您的代码。我已经为您复制并粘贴了您的代码。 http://jsfiddle.net/peduarte/RnKmE/.