Positioning
element at center of screen

后端 未结 13 1438
死守一世寂寞
死守一世寂寞 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:14

    Use flex. Much simpler and will work regardless of your div size:

    .center-screen {
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      text-align: center;
      min-height: 100vh;
    }
     
     
     
     
     
    I'm in the center

提交回复
热议问题