Make the image go behind the text and keep it in center using CSS

前端 未结 7 1481
粉色の甜心
粉色の甜心 2021-02-07 04:10

I am creating a web page, where I have an image that I want to place in the center. On the top of that image I want to have input boxes, labels, and a submit button.

I a

相关标签:
7条回答
  • 2021-02-07 04:49

    Try this code:

    body {z-index:0}
    img.center {z-index:-1; margin-left:auto; margin-right:auto}
    

    Setting the left & right margins to auto should center your image.

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