开发者

How to open div on center screen position?

How to open div on center screen p开发者_开发技巧osition ?


You can define a size for the DIV and position it absolutely (or Fixed), like this:

div{
     position:absolute; /* can also be 'fixed' */
     top:50%; left:50%; 
     width:200px; height:100px; 
     margin:-100px 0 0 -50px;
     z-index:99;
}

Or if you don't want to place it absolutly positioned, you can give it a width, and set it to:

div{ margin:0 auto; }


div{

margin-left: auto;
margin-right: auto;
}

This only works if the div has a width of 95% or less

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜