css3佈局

qq小小布丁發表於2017-07-27

含固定寬度的彈性佈局

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <title>layout</title>
    <style>
        html{
            height: 100%;
        }
        body{
            height: 100%;
            margin: 0;
            padding: 0;
        }
        .wrapper{
            height:100%;
            display: flex;
            flex-flow: row nowrap;
            justify-content: flex-start;
        }
        .left{
            flex: 2 0 auto;
            background-color: #ddd;
        }
        .right{
            width: 300px;
            display: flex;
            flex-flow: column nowrap;
            flex: 0 0 auto;
            background-color: #f2f2f2;
        }
        .right-main{
            flex: 3 0 auto;
            background-color: #ff3;
        }
        .right-bottom{
            flex: 1 0 auto ;
            background-color: #ffe;
        }
    </style>
</head>
<body>
<div class="wrapper">
    <div class="left"></div>
    <div class="right">
        <div class="right-main"></div>
        <div class="right-bottom"></div>
    </div>
</div>
</body>
</html>

這裡寫圖片描述

相關文章