布局案例:
<!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>
.container1 {
display: flex;
/**指定flex 布局*/
flex-direction: row;
/**布局内item 方向*/
flex-wrap: wrap;
/**不够了就换行*/
justify-content: space-between;
/**主轴两边对其*/
border: red 1px solid;
/**显示边框*/
}
.container1 view {
display: flex;
/**指定flex 布局*/
width: 100px;
/**宽度*/
height: 100px;
/**高度*/
justify-content: center;
/**主轴居中*/
align-items: center;
/**交叉轴居中*/
border: 1px #aaa solid;
/**显示边框*/
}
</style>
</head>
<body>
<view class="container1">
<view>1</view>
<view>2</view>
<view>3</view>
<view>4</view>
<view>5</view>
<view>6</view>
<view>7</view>
<view>8</view>
</view>
</body>
</html>
3.弹性布局使用案例
网友评论