微信小程式文字水平垂直居中對齊問題(完美解決方案)
text-align:center;
align-items:center;
justify-content: center;
margin: auto; #子容器在父容器中居中
但是在view中的文字對齊卻不能簡單的使用text-align: center;來實現,這種辦法只能實現文字的水平居中,
要實現水平垂直居中
可使用如下方案
.td {
display: flex;
align-items: center;
justify-content: center;
}
使用了flex佈局控制其中的文字水平和垂直居中