好得很程序员自学网

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

css笔记:如何让一个div居于页面正中间_html/css_WEB-ITnose

如何让一个div居于页面中间,我今天说的是让一个div水平居中同时垂直居中,而不是简单的top:50%,left:50%。当然,我们就按一开始的思路写一下:top,left属性都设为50%,看一下效果。

             div居于页面正中间              *{            margin: 0;            padding: 0;            background-color: #EAEAEA;        }        div{            width: 200px;            height: 200px;            background-color: #1E90FF;        }        .center-in-center{            position: absolute;            top: 50%;            left: 50%;        }           

查看更多关于css笔记:如何让一个div居于页面正中间_html/css_WEB-ITnose的详细内容...

  阅读:34次