简体   繁体   中英

How to keep the footer at bottom in asp.net master page.?

i want to keep my footer at bottom in every child page.

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

</asp:ContentPlaceHolder>

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

You just need to add the following CSS to the footer:

position: absolute;
bottom: 0;

Yau can put ContentPlaceHolder inside a div and set its min-height as per your requirement:

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

It will occupy min-height whether there is data on content page or not.

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;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM