好得很程序员自学网

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

如何实现div水平和垂直居中效果_html/css_WEB-ITnose

如何实现div水平垂直和居中效果:

有时候可能我们需要让一个div在它的父容器中居中显示。先看代码实例再进行分析。

代码实例:

      蚂蚁部落  .parent{  width:500px;  height:500px;  border:1px solid red;  position:absolute;}.children{  width:200px;  height:100px;  background-color:green;  position:absolute;  top:50%;  left:50%;  margin:-50px 0 0 -100px;}   

查看更多关于如何实现div水平和垂直居中效果_html/css_WEB-ITnose的详细内容...

  阅读:40次