微信小程序文字图片水平垂直居中对齐问题
我们知道常用的居中对齐方式有很多种例如:text-align:center;align-items:center;justify-content: center;margin: auto;//子容器在父容器中居中但是在view中的文字对齐却不能简单的使用text-align: center;来实现,这种办法只能实现文字的水平居中,要实现水平垂直居中,可使用如下方案.box{...
·
我们知道常用的居中对齐方式有很多种例如:
text-align:center;
align-items:center;
justify-content: center;
margin: auto; //子容器在父容器中居中
但是在view中的文字对齐却不能简单的使用text-align: center;来实现,这种办法只能实现文字的水平居中,
要实现水平垂直居中,可使用如下方案
.box{
display: flex;
align-items: center;
justify-content: center;
}
使用了flex布局控制其中的文字水平和垂直居中
发表下以便以后调用
转载至https://blog.csdn.net/qq_32590631/article/details/80411024
更多推荐
已为社区贡献1条内容
所有评论(0)