Friday, September 25, 2015

Simple CSS "Sticky Footer"

This method would probably need some tweaking to work in older browsers, but for my purposes, it works pretty good:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <style>
        html {
            height: 100%;
        }
        body {
            height: 100%;
            margin: 0px;
        }
        .container {
            background-color: lightgray;
            height: 100%;
        }
        .footer {
            height: 50px;
            background-color: gray;
            margin-top: -50px;
        }
    </style>
</head>
<body>
    <div class="container">
        
    </div>
    <div class="footer">

    </div>
</body>
</html>

No comments:

Post a Comment