HTML中CSS的运用怎么出现如图的效果

img

div +flex布局

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>flex布局</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .box {
            width: 100%;
            height: 100vh;
        }

        .nav {
            width: 100%;
            height: 10%;
            background: red;
        }

        .header {
            width: 100%;
            height: 5%;
            background: blue;
        }

        .contbox {
            width: 100%;
            height: 80%;
            display: flex;
        }

        .left {
            width: 20%;
            height: 100%;
            background: red;
        }

        .right {
            width: 20%;
            height: 100%;
            background: red;
        }

        .center {
            width: 60%;
            height: 100%;
            background: green;
        }
        .footer{
            width: 100%;
            height: 5%;
            background: blue;
        }
    </style>
</head>

<body>
    <div class="box">
        <div class="nav"></div>
        <div class="header"></div>
        <div class="contbox">
            <div class="left"></div>
            <div class="center"></div>
            <div class="right"></div>
        </div>
        <div class="footer"></div>
    </div>
</body>

</html>

div布局后,给每个div分别设置背景颜色。

整个table跨行跨列再设置样式

给div加背景颜色,用CSS设置颜色