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

前端 未结 7 1489
粉色の甜心
粉色の甜心 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:31

    Start at 0 and go up from there, rather than using -1. For instance, set the div containing your inputs and labels to a z-index of 100, and give the image you want to place behind it a z-index of 50.

    Alternatively just set the image as the background-image of the div containing the inputs and labels. Since the image is probably illustrative and therefore presentational, it doesn't really need to be an actual img element.

提交回复
热议问题