Q1:三行自适应布局
flex-direction未设置
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>pratise</title>
<style>
*{margin:0; padding: 0;text-align: center;}
body{display: flex;}
header{top:0;height: 100px;background-color: #000;color:white;}
main{flex:1; display: flex;}
.side{width: 200px;background-color: #ffff00;}
.main{flex:1;background-color: #ffc0cb;}
footer{bottom:0;background-color: #000;color:white;}
</style>
</head>
<body>
<header>head</header>
<main>
<div class="side">side</div>
<div class="main">main</div>
</main>
<footer>foot</footer>
</body>
</html>```
![image.png](http://upload-images.jianshu.io/upload_images/316258-ac87c7bb1e34fa99.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
Q2:三行自适应布局中,body,html{height: 100%;}才能使main充满剩余高度,为什么咧?直接设置在body或html都不行咧??
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>pratise</title>
<style>
*{padding:0; margin:0;}
body,html{display: flex;flex-direction: column; height: 100%; }
header, footer{line-height: 100px;background-color: #000000;color:white;}
main{flex:1; display: flex;}
.side{width: 100px;background-color: #ffff00;}
.main{flex:1;background-color: #ffc0cb;}
</style>
</head>
<body>
<header>head</header>
<main>
<div class="side">side</div>
<div class="main">main</div>
</main>
<footer>foot</footer>
</body>
</html>```
Q:
Q:
Q:
Q:
Q:
Q:
Q:
Q:
Q:
Q:
Q:
Q:
Q: