Positioning
element at center of screen

后端 未结 13 1254
死守一世寂寞
死守一世寂寞 2020-11-28 18:34

I want to position a

(or a ) element at the center of the screen irrespective of screen size. In other words, the space le
相关标签:
13条回答
  • 2020-11-28 19:23

    If there are anyone looking for a solution,

    I found this,

    Its the best solution i found yet!

    div {
      width: 100px;
      height: 100px;
      background-color: red;
      position: absolute;
      top:0;
      bottom: 0;
      left: 0;
      right: 0;
      margin: auto;
    }
    

    http://dabblet.com/gist/2872671

    Hope you enjoy!

    0 讨论(0)
提交回复
热议问题