Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8668585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:15:01+00:00 2026-06-12T18:15:01+00:00

I am trying to do the following in a CSS template: Dock the footer

  • 0

I am trying to do the following in a CSS template:

  1. Dock the footer to the bottom when there is not enough content to
    fill the page
  2. Stretch the header and footer background across the whole width
  3. Position all the content in the middle of the page

This is the code I have, created with help on here:
http://tinkerbin.com/lCNs7Upq

My question is, I have seen a few ways to achieve this. Is this the best? It seems a shame to have to have the empty div as well, is this a bodge?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T18:15:03+00:00Added an answer on June 12, 2026 at 6:15 pm

    You can fix and element to the footer using CSS:

    position: fixed;
    bottom: 0;
    

    However, I’m trying to figure out what exactly your trying to do.

    You header and footer should automatically go 100% across the page if it’s a div.

    Your middle section can be set to height: auto; via css and will fill up the viewport pushing the footer all the way to the bottom, but to do this you also have to set the body to 100% in order to get it to work.

    html, body, #content {
        height: 100%;
        min-height: 100%;
    }
    #header {
        height: 100px;
        width: 100%;
        background: blue;
        position: fixed;
        top: 0;
    }
    #content {
        height: auto;
        margin: 100px auto;
        background: green;
    }
    #footer {
        position: fixed;
        bottom: 0;
        height: 100px;
        width: 100%;
        background: red;
    }
    

    Your HTML should look somewhat like this:

    <div id="header"></div>
    <div id="content"></div>
    <div id="footer"></div>
    

    Working Example: http://jsfiddle.net/s4rT3/1/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to accomplish the following layout, http://www.rae-mx.com/test/css-layout.jpg and I'm almost there, except for
Can someone tell me why the following css is not validating? I've been trying
I'm trying to accomplish the following using CSS: <table border=1 width=300px> <tr> <td rowspan=2>This
I'm trying to create css buttons by using the following html markup: <a href=access.php
I'm trying to set the CSS style of an object with the following: document.getElementById(obj).style='font-weight:bold;
Using the following CSS, I'm trying to make a navigation bar at the top
I'm trying to implement CSS transition on the hyperlinks, I'm trying following code, but
I am trying to use the following css code in the table I create
I'm following this tutorial and am trying to modify it to my use: http://net.tutsplus.com/tutorials/html-css-techniques/how-to-build-a-kick-butt-css3-mega-drop-down-menu/
I am trying to load inline content using Fancybox in a custom wordpress page

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.