<!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>
<style>
*{
padding: 0;
margin: 0;
}
body{
height: 100vh;
/* 100%高度 */
display: flex;
flex-direction: column;
/* 主轴按列排列 */
justify-content: space-between;
/* 内容平均分布 */
}
header{
height: 60px;
background-color: aqua;
}
main{
flex-grow: 1;
/* 占满剩余空间 */
background-color: blue;
}
footer{
height: 60px;
background-color: aqua;
}
</style>
</head>
<body>
<header></header>
<main></main>
<footer></footer>
</body>
</html>
CSS day12 移动端布局练习
最新推荐文章于 2024-01-08 20:56:19 发布