使用 flex 布局實(shí)現(xiàn)中間自適應(yīng)兩邊固定的三列布局吩跋!
代碼
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style>
*{
margin:0;
padding:0;
}
body{
display:flex;
flex-direction:column;
}
header,footer{
flex:0 0 80px;
background-color:#6ff;
}
.main{
display:flex;
flex:1;
height:200px;
}
.left,.right{
background-color:#6fa;
flex:0 0 100px;
}
.left{
order:-1;
}
.middle{
background-color:#fbf;
flex:1;
}
</style>
</head>
<body>
<header>header</header>
<div class = "main">
<div class = "middle">middle</div>
<div class = "left">left</div>
<div class = "right">right</div>
</div>
<footer>footer</footer>
</body>
</html>