css设置文字上下居中,一行文字居中,两行或多行文字同样居中。

 

HTML:

 <div class="book-detail-store-item align-center-vertical">居中文字</div>

 

 

CSS:

.book-detail-store-item {
    width: 50px;
    height:50px;
    line-height: 25px;
    font-size: 12px;


}

/*flex垂直居中对齐*/
.align-center-vertical{
     display: flex;
    align-items: center;
    justify-content: space-around;
    flex-direction: column;
}

 

相关文章:

  • 2022-01-01
  • 2022-12-23
  • 2022-12-23
  • 2021-08-31
  • 2022-12-23
  • 2021-12-05
  • 2021-10-10
猜你喜欢
  • 2021-12-05
  • 2021-12-15
  • 2021-06-03
  • 2022-12-23
  • 2022-02-01
相关资源
相似解决方案