Html底部对齐(页脚)

Posted 绿叶清风

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Html底部对齐(页脚)相关的知识,希望对你有一定的参考价值。

  • 要点:
    • 父元素高度固定、且相对定义
    • 子元素采用绝对定位 ,且bottom为0

<!DOCTYPE html>
<html>
<head>
    <title>Listening to DOM events</title>
    <style type="text/css">
        .box1 {
            border: 1px #cccccc solid;
            width: 500px;
            height: 600px;
            position: absolute;
        }
 
        .box2 {
            border-top: 1px #cccccc solid;
            width: 100%;
            height: 70px;
            position: absolute;
            background-color: green;
            bottom: 0;
        }
    </style>
</head>
<body>
 
    <div class="box1" style="border: 1px solid red;">
        <div class="box2" style="border: 1px solid blue;"></div>
    </div>
</body>
</html>

以上是关于Html底部对齐(页脚)的主要内容,如果未能解决你的问题,请参考以下文章