分类
技术

使 footer 显示在页面底部

页面内容比较少的时候,footer 置于底部,整体看起来或许会更好。

<!DOCTYPE html>
<html>
<head>
    <style type="text/css">
        html {
            height: 100%;
        }
        body {
            position: relative;
            min-height: 100%;
        }
        .container {
            padding-bottom: 50px;
        }
        .footer {
            position: absolute;
            bottom: 0;
            left: 0;
            height: 50px;
            width: 100%;
        }
    </style>
</head>
<body>
    <div class="header"></div>
    <div class="container"></div>
    <div class="footer"></div>
</body>
</html>

参考资料

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注