Search code examples
htmlcssfootersticky-footer

Weird margin on footer


I have got a footer on my homepage that weirdly has a margin around it for no apparent reason (seems to me at least). I just want a footer pretty much like the on this very page. Just a plain footer with 100% width. The problem is (as you can hopefully see in the picture I provided), there is a margin on the left, right and bottom of about 9px.

Here is the CSS:

#footer_container{

    background: #181818;
    height: 200px;
    width: 100%;
    bottom:0;
    left:0;
    margin:0px 0px 0px 0px;
}

HTML

<body>
</body>
<div id="footer_container">
</div>

This is what it looks like:

enter image description here


Solution

  • Add a CSS rule for the HTML body:

    body {
        padding: 0;
        margin: 0;
    }
    

    And your body should look like this (div inside body):

    <body>
        <div id="footer_container">
        </div>
    </body>