uniapp中flex设置居中
.horViewStyle {display: flex;flex-direction: row;width: 100%;height: 80rpx;align-items: center;//垂直居中background-color: #4399FC;}.textHorStyle {display: flex;height: 60%;...
·
.horViewStyle {
display: flex;
flex-direction: row;
width: 100%;
height: 80rpx;
align-items: center;//垂直居中
background-color: #4399FC;
}
.textHorStyle {
display: flex;
height: 60%;
width: 100%;
align-items: center;//适合单行显示的组件,垂直居中
justify-content: center;//水平居中
color: #FFFFFF;
}
注意的点:要设置display为flex,
align-content也可以设置组件垂直居中,但适合多行文字显示的组件,垂直居中。
更多推荐
已为社区贡献1条内容
所有评论(0)