flex 學習筆記
flex-basis的優先級大於 寬度或高度的值。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>flex</title>
<style type="text/css">
* {
margin: 0;
padding: 0;
}
.container {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
width: 85%;
margin: 40px auto;
background: #dfd;
border: 10px solid #e0dfcc;
height: 400px;
border-radius: 6px;
}
.item {
width: 100px;
/*flex: 1;*/
flex-basis: 200px;
height: 100px;
margin: 5px;
background: #3f88bf;
}
</style>
</head>
<body>
<div class="container">
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
</div>
</body>
</html>
flex 學習筆記