asp.net - 展开 GridView 时,页脚 div 不会停留在下方

标签 asp.net css master-pages footer

我有这个页面,其中有一个页脚,该页面还显示一个 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/

相关文章:

c# - 位置0处无行错误处理

c# - 发布新版 ASP.NET 网站 - 最佳实践

asp.net - 发布时母版页无法加载类型错误

asp.net - Ajax 和 ASP.NET MasterPages 可以混合使用吗?

sharepoint-2007 - 如何更改 sharepoint 中特定页面的母版页

c# - 日期与日期时间

c# - ASP.net UserControl 和 AppDomain TypeResolve

css - Angular/SCSS : animation not applied on element

javascript - js弹出窗口没有出现

css - IE Alpha Png 修复不起作用