我有这个页面,其中有一个页脚,该页面还显示一个 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,但这不是我想要的,页脚显示在页面内容之上的方式,我希望它位于底部。如果我将它设置为 relative,它会设置到母版页内容占位符的底部,但你仍然可以在 Gridviews 后面看到它,如果我将它设置为 absolute,它会到达底部,但它仅在Gridview 的行数有一定的小,如果要显示很多行,页脚也会出现在 gridviews 的后面。
这让我发疯。感谢您的任何建议。
最佳答案
试试这个: 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/
*/
关于asp.net - 展开 GridView 时,页脚 div 不会停留在下方,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13799151/