我有一个页面,其中我有一个页脚,页面也显示一个Gridview,Gridview的内容取决于用户选择的内容,Gridview可能从什么都没有,到168行,以及介于两者之间的所有内容。
母版页是这样的:
<html>
<body>
STUFF
<div id="footer">
<p>This is the footer</p>
</div>
</body>
</html>
CSS就像这样:
#footer {
width: 100%;
height: 60px;
margin: 0 auto;
padding: 0;
background: #E1E1E1;
position:absolute;
bottom:0;
}
现在,我已尝试过position:fixed,但这不是我想要的,这就是页脚显示在页面内容上的方式,我希望它位于底部。如果我将它设置为相对,它设置为母版页的内容占位符的底部,但你仍然可以在Gridviews后面看到它,如果我将它设置为绝对,它会到底,但它只适用于Gridview具有一定的小行数,如果必须显示多行,则页脚也会出现在网格视图后面。
这让我发疯了。感谢您的任何建议。
答案 0 :(得分:1)
试试这个: Sticky Footer
* {
margin: 0;
}
html, body {
height: 100%;
}
.wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -142px; /* the bottom margin is the negative value of the footer's height */
}
.footer, .push {
height: 142px; /* .push must be the same height as .footer */
}
/*
Sticky Footer by Ryan Fait
http://ryanfait.com/
*/