div height 自适应高度 占满剩余高度的方法

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        html,
        body {
            margin: 0;
            padding: 0;
            height: 100%;
        }
        .if-top {
            display: block;
            border: none;
            width: 100%;
            height: 120px;
        }
        .if-menu {
            width: 20%;
            height: 100%;
            border: none;
        }
        .if-content {
            width: 78%;
            height: 100%;
            border: none;
        }

        .div-outer {
            height: 100%;
            box-sizing: border-box;
            padding-top: 100px;
        }

        .div-top {
            background-color: burlywood;
            height: 100px;
            margin-top: -100px;
        }
        .div-content {
            background-color: #8ddad3;
            height: 100%;
        }
    </style>
</head>
<body>
    <div class="div-outer">
        <div class="div-top">
            你好
        </div>
        <div class="div-content">
            世界
        </div>
    </div>
    <!--<iframe class="if-top" src="top.html"></iframe>-->
    <!--<iframe class="if-menu" src="menu.html"></iframe>-->
    <!--<iframe class="if-content" src="content.html"></iframe>-->
</body>
</html>

这个方法挺好的

posted @ 2017-09-11 11:15  鸡毛巾  阅读(4344)  评论(0编辑  收藏  举报