如何将div中的内容居中

原文地址:

https://blog.csdn.net/liuhailiuhai12/article/details/55252283

1. .parent{

  width:400px;

height:500px;

    display:flex;

    justify-content: center;

    align-items: center;

}

2.单行文字垂直居中

line-height等于父类的height

3.display:table和table-cell    

.parent {
           display: table;
           width: 300px;
           height: 300px;
           text-align: center;
       }
       .son  {
           display: table-cell;
           height: 200px;
           background-color: yellow;
           vertical-align: middle;
       }
原文地址:https://www.cnblogs.com/chen-cong/p/8076442.html

猜你喜欢

转载自www.cnblogs.com/kingsmart/p/12766385.html
今日推荐