好久没用微信开发工具,今天写项目的时候又踩坑了想让文字水平垂直居中,本来使用的是 text-algin: center结果结果他没有任何作用,编译了好几遍还以为反应慢了。最后问了度娘才知道 view 中的文字对齐不能简单使用text-algin-center ,他只能实现文字水平居中 水平垂直居中用下面的方法
display:flex
;
align-items:center
;
justify-content:center
;
(多嘴一句,flex 是真好用) 补充文字水平垂直居中的方法
text-algin:center #最普遍
align-items:center
;
justify-content:center
;
margin:auto #子容器在父容器中居中