【问题标题】:How to keep the footer at bottom in asp.net master page.?如何将页脚保持在 asp.net 母版页的底部。?
【发布时间】:2015-09-05 22:34:53
【问题描述】:

我想把我的页脚放在每个子页面的底部。

<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">

</asp:ContentPlaceHolder>

<div class="footer">
footer content
</div>

【问题讨论】:

标签: c# asp.net .net css sticky-footer


【解决方案1】:

您只需在页脚中添加以下 CSS:

position: absolute;
bottom: 0;

【讨论】:

    【解决方案2】:

    Yau 可以将ContentPlaceHolder 放入div 并根据您的要求设置其min-height

      <div style="min-height:500px;">
       <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
        </asp:ContentPlaceHolder>
      </div>
    

    content page上是否有数据会占用min-height

    【讨论】:

    • 但这不是我的要求,对吧。?页脚应该在每一页的底部
    • 那么你应该按照@Hashem Qolami的建议尝试一些jquery粘性页脚
    • 好主意.. 自 2012 年以来,我一直在搜索母版页问题的此类调整 :)
    【解决方案3】:
    html,
    body {
    margin:0;
    padding:0;
    height:100%;
    }
    #wrapper {
    min-height:100%;
    position:relative;
    }
    #header {
    padding:10px;
    background:#5ee;
    }
    #content {
    padding:10px;
    padding-bottom:80px; /* Height of the footer element */
    }
    #footer {
    width:100%;
    height:80px;
    position:absolute;
    bottom:0;
    left:0;
    background:#ee5;
    }
    

    【讨论】:

      猜你喜欢
      • 2022-11-23
      • 2021-07-15
      • 2016-04-14
      • 1970-01-01
      • 2012-08-11
      • 1970-01-01
      • 2015-07-28
      • 2013-09-15
      相关资源
      最近更新 更多