我想把页脚放在页面底部,但一直没有成功。
由于CSS代码很多,我只能提供链接,不确定问题出在哪里。
这是链接:测试;如果有人能帮助我,我会非常感激。
编辑:这个问题很老了,链接也不存在了,但当有人需要将页脚(或其他元素)固定在页面底部时,答案仍然有效。
由于CSS代码很多,我只能提供链接,不确定问题出在哪里。
这是链接:测试;如果有人能帮助我,我会非常感激。
编辑:这个问题很老了,链接也不存在了,但当有人需要将页脚(或其他元素)固定在页面底部时,答案仍然有效。
最近我使用过这个解决方案。它非常有效。如果您的页脚中有动态内容,您可以轻松编写一个脚本,在调整大小或更改方向时更改页脚的高度和页面边距。
html {
position: relative;
min-height: 100%;
}
body {
margin-bottom: 100px;
}
footer {
position: absolute;
bottom: 0;
width: 100%;
height: 100px; //same height as the margin to the bottom of the body
}
#footer {
margin-top: -50px;
}
footer {
background-image: url("http://rolandgroza.com/projects/roland/assets/less/../gfx/background-light.png");
background-position: center center;
background-repeat: repeat;
clear: both;
height: 50px;
position: relative;
width: 100%;
}
footer {
background-image: url("http://rolandgroza.com/projects/roland/assets/less/../gfx/background-light.png");
background-position: center center;
background-repeat: repeat;
bottom: 0;
height: 50px;
left: 0;
position: absolute;
width: 100%;
}
footer {
display: block;
}
你可以删除第一个带有"display:block"和最后一个定义集。如果你能在某个地方找到它们。
<header class="row">header content</header>
<div class="row">content here</div>
<footer class="row">footer content</footer>
html {
height:100%;
width:100%;
}
body {
height:100%;
width:100%;
display:table;
table-layout:fixed;
margin:0 auto;
}
.row {
display:table-row;
background:orange
}
div.row {
height:100%;
background:pink
}
.footerClass {
position:absolute;
bottom:0;
}
z-index
让它停留在内容上方,但我想要的是内容将页脚向下推,并且内容始终具有100%的高度,以便无论内容内部是什么,都将页脚推到页面底部。 - Roland