弹性盒子圣杯布局

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="./css/index.css">
</head>
<body>
    <header></header>
    <div class="body">
        <nav></nav>
        <section></section>
        <aside></aside>
    </div>
    <footer></footer>
</body>
</html>
*{
    margin: 0;
    padding: 0;
    list-style: none;
}

header,
footer {
    height: 50px;
    background-color: aquamarine;
}

header {
    flex: 0 0 60px;
}

footer {
    flex: 0 0 40px;
}
html {
    height: 100%;
}
body {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.body {
    flex: 1;
    display: flex;
}

nav,
aside {
    flex: 0 0 150px;
}

section {
    flex: 1;
    background-color: blueviolet;
}
相关文章
相关标签/搜索