jiceberg420

刚刚接触CSS,用了各种方法都不行,

什么。。。

vertical-align: middle;
align-content: center;
align-items: center;
text-align: center;
 
都不能达到垂直状态下的居中对齐。
 
后来终于百度到一篇靠谱的帖子
https://blog.csdn.net/qq_32590631/article/details/80411024
 
亲测可行,马克以下:
--------------------------------------------------------------------
.center-text{
display: flex;
align-items: center;
justify-content: center;
}
 
<view class="center-text" style="width: 100px;height:100px">ABC</view>
--------------------------------------------------------------------

分类:

技术点:

相关文章:

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