calc计算属性实现三列布局

106 阅读1分钟
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
    <div class="left"></div>
    <div class="center"></div>
    <div class="right"></div>
    </div>
</body>
</html>
<style>
    .center,
    .left,
    .right {
        float: left;
        height: 200px;
    }
    .left,.right {
        width: 200px;
    }
    .left {
        background: red;
    }
    .right {
        background: blue;
    }
    .center {
        width: calc(100% - 400px);
        background: yellow;
    }
</style>