我有3个div,每个div都有position: absolute
。position:absolute,div div div
首先是标题,它的工作。
标题具有不变的高度,第二个div“content”也起作用。
第三格是“页脚”。
“内容”具有可变的高度,当“内容”高于网页浏览器窗口时,“页脚”为ON“内容”。无论内容的高度如何,我都想在“内容”下面“脚注”。
我的标题为300px高度,内容为margin-top: 300px
。我不能在页脚上使用相同的内容,因为内容的高度并不一致。
我不想设置一个div与position: absolute
,并且这3个div位于这个里面。
div#header{
width: 960px;
height: 200px;
left: 50%;
margin-left: -480px;
position: absolute;
}
div#content{
width: 960px;
border: 1px solid black;
left: 50%;
margin-left: -480px;
position: absolute;
margin-top: 200px;
}
div#footer{
width: 960px;
height: 30px;
left: 50%;
margin-left: -480px;
position: absolute;
bottom: 10px; /*with this i've div fixed to the bottom of web-browsers' window */
clear: both;
}
能否请您示例代码添加到这个问题? – andyb 2011-12-16 08:00:27
你也可以在这里创建“小提琴”:http://jsfiddle.net/例如。 – span 2011-12-16 08:04:20
http://paste.org/42377 – aptyp 2011-12-16 08:14:18