<!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>
.wrapper{
display:flex;
width: 100%;
height:50px;
}
.box{
flex:1 0 50px;
/*flex-grow flex-shrink flex-basis*/
/*擴張率 壓縮率 基本寬或高*/
height:50px;
}
.box:nth-child(3n){
flex-grow:3;
background-color: #f00;
}
.box:nth-child(3n+1){
background-color: #0f0;
}
.box:nth-child(3n+2){
background-color: #00f;
}
</style>
</head>
<body>
<div class="wrapper">
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
</div>
</body>
</html>
2018年2月15日 星期四
【Flex】把flex-grow(擴張率)、flex-shrink(壓縮率)、flex-basis(基本寬或高)寫成一行
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言