footer position wrong - HTML5 page

Posted on 2012-09-08
Last Modified: 2012-09-08
Help!  I'm putting together a website in HTML5 - my footer is not at the very bottom of the container, and I can't figure out why.  Please let me know what I did wrong.

Thanks very much.  More questions on this website coming throughout the day!  Lots of points to be scored!
Question by:Revolution9
    LVL 25

    Accepted Solution

    give container position relative, and footer position absolute, then bottom:0

    .container {
    width: 960px;
    background: white;
    -moz-box-shadow: 0px 0px 40px #000000;
    -webkit-box-shadow: 0px 0px 40px black;
    box-shadow: 0px 0px 40px black;
    margin-top: 50px;
    height: 500px;
    margin-right: auto;
    margin-bottom: 0;
    margin-left: auto;
    position: relative;
    footer {
    padding: 10px 0;
    background: #CCC49F;
    position: absolute;
    bottom: 0;

    Open in new window


    Author Closing Comment

    I had to manually stretch the footer area to make it the same width as the container, it fell a bit short.  Thanks so much for your help!
    LVL 17

    Expert Comment

    Yes,,,, i agree w/ above.

    Depending on the needs of the page.
    you could also add

            min-height: 280px; 

    Open in new window

    The you style css


    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    "I want to put my photos online, but I don't want them stolen.  What settings should I use?" When You Put Photos Online First and foremost, any digital file published on the WWW can be copied, stored, modified, retransmitted, etc.  Remember Naps…
    When writing CSS, there are a few simple rules that will make your life easier.    1. Using ‘* {box-sizing:border-box;}’. Using this will wrap all your elements in a nice little compact box-model that will give you the width you want, like so... …
    In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
    In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at Browse or search based on font properties or name to find a suitable font for…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now