. . .

Make the Footer Stick to the Bottom of a Page

Published: November 9, 2010

On This Page

    Step 1: Markup

     

    <html>
    	<head><!-- header includes... --></head>
    <body>
    	<div class="wrap">
    		<div class="header"></div>
    		<div class="middle"></div>
    	</div>
    	<div class="footer">
    		<!-- footer contents ... -->
    	</div>
    </body>
    </html>

     

    Step 2: CSS

     

    html,body{height:100%;}
    .wrap {min-height: 100%;height: auto !important;height: 100%;}
    .middle {overflow:auto;padding-bottom: 50px;}
    .footer{position: relative;margin-top: -50px;height: 50px;clear:both;}

     where the negative margin of footer and padding-bottom of middle should be equal to footer height.

    Don't forget to share this post

      Let's Build Digital Excellence Together


      • Cost Efficient Solutions.
      • Minimal Timelines.
      • Effective Communication.
      • High Quality Standards.
      • Lifetime Support.
      • Transparent Execution.
      • 24/7 Availability.
      • Scalable Teams.

      Join Our 200+ Happy Clients Across Globe


      Free Consultation.

        Do you need tech help of your startup/business? Experts from our team will get in touch with you.

        Please do not post jobs/internships inquiries here.