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

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

    Well, put your image in the background of your website/container and put whatever you want on top of that.

    Your container defined in HTML:

    Your CSS would look like this:

    #container {
        background-image:url(yourimage.jpg);
        background-position:center;
        width:700px;
        height:400px;
    }
    

    For this to work though, you must have height and width specified to certain values (i.e. no percentages). I could help you more specifically if you wanted, but I'd need more info.

提交回复
热议问题