justify-content属性定义了项目在主轴上的对齐方式。(左中右)
justify-content: flex-start | flex-end | center | space-between | space-around;
}
{C}u {C}flex-start(默认值):左对齐
{C}u {C}flex-end:右对齐
{C}u {C}center: 居中
{C}u {C}space-between:两端对齐,项目之间的间隔都相等。
{C}u {C}space-around:每个项目两侧的间隔相等。所以,项目之间的间隔比项目与边框的间隔大一倍。
<view class='zong'>
<view class='fangxing'>
<text>01</text>
</view>
<view class='fangxing'>
<text>02</text>
</view>
</view>
/* */
.zong{
display: flex;
justify-content: flex-start;
/*flex-start是默认值:flex-start|flex-end|center|space-between|space-around*/
}
.fangxing{
width: 100px; height: 100px;
background-color: beige;
}
.zong{
display: flex;
justify-content: flex-end;
/*flex-start是默认值:flex-start|flex-end|center|space-between|space-around*/
}
.zong{
display: flex;
justify-content: center;
/*flex-start是默认值:flex-start|flex-end|center|space-between|space-around*/
}
.zong{
display: flex;
justify-content: space-between;
/*flex-start是默认值:flex-start|flex-end|center|space-between|space-around*/
}
Wxss代码
.zong{
display: flex;
justify-content: space-around;
/*flex-start是默认值:flex-start|flex-end|center|space-between|space-around*/
}