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