Positioning
element at center of screen

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

    Alternative solution that doesn't use position absolute:
    I see a lot of position absolute answers. I couldn't use position absolute without breaking something else. So for those that couldn't as well, here is what I did:
    https://stackoverflow.com/a/58622840/6546317 (posted in response to another question).

    The solution only focuses on vertically centering because my children elements were already horizontally centered but same could be applied if you couldn't horizontally center them in another way.

提交回复
热议问题