使用css3 flex,實現頭部、左側欄固定,內容區域滾動顯示


使用css3 flex實現 頭部、左側欄不變,內容區域滾動顯示

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        html, body{height: 100%;margin: 0;padding: 0;}
        .wrap{background: #a00;height: 100%;display: flex;flex-direction: column}
        .hd{background: #2980b9;flex: 0 0 60px}
        .bd{flex-grow: 1;display: flex;overflow: auto;}
        .left{background: #ecf0f1;border: solid 5px #e67e22;width: 200px;}
        .content{background: #ecf0f1;border: solid 6px #f1c40f;flex-grow: 1;overflow: auto;}
    </style>
</head>

<body>
    <div class="wrap">
        <div class="hd">頭部</div>
        <div class="bd">
            <div class="left">左側</div>
            <div class="content">
                <div style="height: 2050px;overflow-y: auto;">內容</div>
            </div>
        </div>
    </div>
</body>
</html>

效果

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM