废话不多说,直接上代码!立马上手写起来~~
<!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>Document</title>
<style>
* {
padding: 0;
margin: 0;
border: 0;
}
html,
body {
height: 100%;
}
body {
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
}
.main {
height: 100%;
display: flex;
flex-direction: column;
}
.top {
height: 100px;
background-color: pink;
}
.center {
flex: 1;
background-color: hotpink;
}
.bottom {
height: 100px;
background-color: green;
}
</style>
</head>
<body>
<div class="main">
<div class="top"></div>
<div class="center"></div>
<div class="bottom"></div>
</div>
</body>
</html>
现在觉得flex布局越来越上手了~~~,fightting~~~~