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

前端 未结 6 1534
一生所求
一生所求 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 12:18

    If you aren't comfortable with using negative margins, check this out.

    HTML -

    Your Text

    CSS -

    div {
      position: fixed;
      left: 50%;
      bottom: 20px;
      transform: translate(-50%, -50%);
      margin: 0 auto;
    }
    

    Especially useful when you don't know the width of the div.

提交回复
热议问题