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>

这个方法挺好的


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM