view组件中如何设置文字垂直居中

发布于 7 年前作者 chao1816522 次浏览最后编辑 7 年前来自 ask

<!–index.wxml–>

<!-- 怎么让 开吉尔 3个字 垂直也居中–>

<view class=“txtstyle”>开吉尔</view>

/**index.wxss**/

.txtstyle{

width:100px;

height:100px;

text-align:center;

}

3 回复
echen
echen1 楼6 年前

line-height … …

liding
liding2 楼6 年前

谢谢您。line-height可以做到。

lei14
lei143 楼5 年前

可以试试 flex 布局