CSS sets the text to be centered up and down, one line of text is centered, and two or more lines of text are also centered

Original link http://www.cnblogs.com/handsomeBoys/p/6567063.html

 

 

 

HTML:

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

 

 

CSS:

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


}

/*flex vertical center alignment*/
.align-center-vertical{
     display: flex;
    align-items: center;
    justify-content: space-around;
    flex-direction: column;
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324930260&siteId=291194637