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

原文链接 http://www.cnblogs.com/handsomeBoys/p/6567063.html

 

 

 

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;
}
posted @ 2018-04-27 10:18  Marco CAO  阅读(513)  评论(0编辑  收藏  举报