How to align absolutely positioned element to center?

后端 未结 7 1529
遇见更好的自我
遇见更好的自我 2020-12-22 17:51

I am trying to stack two canvas together and make it a double layers canvas.

I\'ve saw an example here:

&l
相关标签:
7条回答
  • 2020-12-22 18:39

    If you set both left and right to zero, and left and right margins to auto you can center an absolutely positioned element.

    position:absolute;
    left:0;
    right:0;
    margin-left:auto;
    margin-right:auto;
    
    0 讨论(0)
提交回复
热议问题