Friday, January 4, 2013

How to use the CSS Sticky Footer on your website


HTML and CSS
 Add the following lines of CSS to your stylesheet. The negative value for the margin in .wrapper is.footer and .push. The negative margin should always equal to the full height of the footer (including any padding or borders you may add).
the same number as the height of

* {
margin: 0;
}
html, body {
height: 100%;
}
.wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -4em;
}
.footer, .push {
height: 4em;
}


Follow this HTML structure. No content can be outside of the .wrapper and .footer div tags unless it is absolutely positioned with CSS. There should also be no content inside the .push div as it is a hidden element that "pushes" down the footer so it doesn't overlap anything.

<html>

    <head>

        <link rel="stylesheet" href="layout.css" ... />

    </head>

    <body>

        <div class="wrapper">

            <p>Your website content here.</p>

            <div class="push"></div>

        </div>

        <div class="footer">

            <p>Copyright (c) 2013</p>

        </div>

    </body>

</html>


Multi column layout with Sticky Footer



Add clear to the .push div

.footer, .push {
clear: both;
}
 Reference : Resources for Web Designer
 

3 comments:

  1. visit Nepal Beauty to get more information about Nepal and its beauty.

    ReplyDelete
  2. Reviewing this on the iPad and the layout was all over the place - I could
    still check out the information but the navigation
    hyperlinks were challenging to get at, simply thought I would certainly
    state it so you can check it out

    Also visit my website: Kyle

    ReplyDelete
  3. I ADAMS KEVIN, a representative Aiico Insurance plc, we trust and respect for individual differences in day out a loan. We will provide 2% of the loan's interest rate. If you are interested in this business contact us by e-mail: (adams.credi@gmail.com) now transfer their loan documents issued properly. Do you need a loan to set up business or school if you are very welcome to Aiico Insurance plc. You can also contact us by e-mail: (adams.credi@gmail.com). We first week can request a balance transfer.

    DO YOU NEED LOAN FOR PERSONAL BUSINESS? IF YOU CONTACT YOUR EMAIL ABOVE TO PROCEED WITH YOUR LOAN TRANSFER IMMEDIATELY OK.

    ReplyDelete