How do I position a div at the bottom center of the screen

前端 未结 6 1503
一生所求
一生所求 2020-12-25 11:17

I have this css:

#manipulate
{
  position:absolute;
  width:300px;
  height:300px;
  background:#063;
  bottom:0px;
  right:25%;
}

I have t

6条回答
  •  时光说笑
    2020-12-25 11:57

    You can center it using negative margins BUT please note that it'll center exactly on the center of the screen IF any containing div is NOT SET to position:relative;

    For example. http://jsfiddle.net/aWNCm/

    So, best way to exactly center this div is to set correct properties position properties for its containing divs too otherwise it will be lost in some random ways.

提交回复
热议问题