526,水平垂直均居中的方法

  • 使用flex-box布局(要注意flex在ie9以下是用不了的)                               

            eg,父元素{   justfy-content:center,align-item:center;display:flex;}   

  • 对于已知宽高的元素,可以父元素:position:relative;

          子元素:position:absolute;top:0; left:0;bottom:0;right:0;margin:auto;

   

一日之计在于晨
原文地址:https://www.cnblogs.com/1998Archer/p/12392994.html