圣杯布局(grid版)
程序员文章站
2022-03-07 18:42:55
...
<!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>圣杯布局(grid版)</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body * {
background-color: chartreuse;
}
body {
display: grid;
grid-template-columns: 200px minmax(400px, 1fr) 200px;
grid-template-rows: 10em minmax(calc(100vh - 20em - 0.6em), 1fr) 10em;
gap: 0.3em;
}
header,
footer {
grid-column: span 3;
}
</style>
</head>
<body>
<header>页眉</header>
<aside>左侧</aside>
<main>主题</main>
<aside>右侧</aside>
<footer>页脚</footer>
</body>
</html>
上一篇: php return什么意思
下一篇: css的color属性有继承性吗?