双飞翼布局

90 阅读1分钟
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div class="box">
        <div class="center"></div>
    </div>
    <div class="left"></div>
    <div class="right"></div>
    </div>
</body>

</html>
<style>
    .box,
    .left,
    .right {
        float: left;
    }

    .left,
    .right {
        width: 200px;
        height: 200px;
    }

    .left {
        background: red;
        margin-left: -100%;
    }

    .right {
        background: blue;
        margin-left: -200px;
    }

    .box {
        width: 100%;
    }

    .box .center {
        margin: 0 200px;
        background: yellow;
        height: 400px;
    }
</style>