Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

One method to position the body div at the bottom of the page is to use CSS. Here's an example:

HTML:

<body>
  <div class="content">
    <!-- page content here -->
  </div>
  <div class="footer">
    <!-- footer content here -->
  </div>
</body>

CSS:

html, body {
  height: 100%;
  margin: 0;
}

.content {
  min-height: 100%;
  margin-bottom: -50px; /* height of the footer */
}

.footer {
  height: 50px;
}

This method sets the height of the HTML and body elements to 100% and removes any margins. The content div has a min-height of 100% to stretch to the bottom of the page, then the margin-bottom is set to the height of the footer to push it off screen. Finally, the footer div has a fixed height.