kongxc

我们知道常用的居中对齐方式有很多种例如:

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布局控制其中的文字水平和垂直居中

 

 

 

来源:https://blog.csdn.net/qq_32590631/article/details/80411024

分类:

技术点:

相关文章:

  • 2021-11-27
  • 2022-02-07
  • 2022-12-23
  • 2022-02-18
  • 2021-07-01
  • 2021-12-14
猜你喜欢
  • 2021-12-05
  • 2022-12-23
  • 2021-11-21
  • 2022-02-23
  • 2021-12-22
  • 2021-12-04
  • 2021-12-15
相关资源
相似解决方案