align-items属性定义项目在交叉轴上如何对齐。(上中下)
它可能取5个值。具体的对齐方式与交叉轴的方向有关,下面假设交叉轴从上到下。
<view class='zong'>
<view class='fangxing1'>
<text>01</text>
</view>
<view class='fangxing2'>
<text>02</text>
</view>
<view class='fangxing3'>
<text>03</text>
</view>
</view>
.zong{
display: flex;
justify-content: space-around;
align-items: flex-start;/*默认值是stretch,属性值有:flex-start | flex-end | center | baseline | stretch */
}
.fangxing1{
width: 60px; height: 60px;
background-color: beige;
}
.fangxing2{
width: 30px; height: 30px;
background-color: beige;
}
.fangxing3{
width: 90px; height: 90px;
background-color: beige;
}
.zong{
display: flex;
justify-content: space-around;
align-items: flex-end;
/*默认值是stretch,属性值有:flex-start|flex-end|center|baseline|stretch */
}
.zong{
display: flex;
justify-content: space-around;
align-items: center;
/*默认值是stretch,属性值有:flex-start|flex-end|center|baseline|stretch */
}
.zong{
display: flex;
justify-content: space-around;
align-items: baseline;
/*默认值是stretch,属性值有:flex-start|flex-end|center|baseline|stretch */
}
小程序应用:wxml代码沿用上小节
.zong{
display: flex;
justify-content: space-around;
align-items: stretch;
/*默认值是stretch,属性值有:flex-start|flex-end|center|baseline|stretch */
}
小程序应用:wxml代码沿用上小节
.zong{
display: flex;
justify-content: space-around;
align-items: stretch;
/*默认值是stretch,属性值有:flex-start|flex-end|center|baseline|stretch */
}
.fangxing1{
background-color: beige;
}
.fangxing2{
width: 30px; height: 30px;
background-color: beige;
}
.fangxing3{
width: 90px; height: 90px;
background-color: beige;
}