好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

《Web开发中让盒子居中的几种方法》

一、记录下几种盒子居中的方法:

1.0、margin固定宽高居中;

2.0、负margin居中;

3.0、绝对定位居中;

4.0、table-cell居中;

5.0、flex居中;

6.0、transform居中;

7.0、不确定宽高居中(绝对定位百分数);

8.0、button居中。

二、代码演示(html使用同一个Demo):

html Demo:

   body  > 
       div   id  ="container"  > 
           div   id  ="box"  >  div  > 
       div  > 
   body  >  

查看更多关于《Web开发中让盒子居中的几种方法》的详细内容...

  阅读:34次