html5

109 阅读1分钟
<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>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        html,
        body {
            height: 100%;
        }

        .box {
            height: 100%;
            background-color: blue;
        }

        header {
            line-height: 50px;
            text-align: center;
            background-color: violet;
        }

        .main {
            height: calc(100% - 50px);
            background-color: blueviolet;
        }

        nav {
            line-height: 35px;
            background-color: chartreuse;
        }

        .content {
            height: calc(100% - 35px - 50px);
            text-align: center;
            overflow: hidden;
        }

        aside {
            width: 30%;
            height: 100%;
            background-color: cadetblue;
            text-align: center;
            float: left;
            position: relative;
        }

        aside span {
            position: absolute;
            top: 50%;
            margin-top: -10.4px;
            left: 50%;
            margin-left: -24px;
        }

        article {
            width: 70%;
            height: 100%;
            background-color: yellow;
            float: left;
            position: relative;
        }

        article span {
            position: absolute;
            top: 50%;
            margin-top: -10.4px;
            left: 50%;
            margin-left: -16px;
        }

        footer {
            line-height: 50px;
            background-color: violet;
            text-align: center;
        }
    </style>
</head>

<body>
    <!-- 设置透明 -->
    <!-- opcity 透明度,值越低越透明 最大是1 -->
    <!-- background-color:transparent -->
    <!-- rgb( ; ; ; )中前三个设置三原色颜色代码。最后一个是透明度,值越低越透明 -->
    <div class="box">
        <header>头部</header>
        <div class="main">
            <nav>导航</nav>
            <div class="content">
                <aside><span>侧边栏</span></aside>
                <article><span>正文</span></article>
            </div>
            <footer>底部</footer>
        </div>
    </div>
</body>

</html>