how to position a background for a big image which is centered at the center of the page?

后端 未结 1 1819
时光取名叫无心
时光取名叫无心 2021-01-25 07:22

I have a image with dimension with dimensions 2350*180.

I am working on Phone gap. So,I need to give the code in a generic format so that it is applicab

1条回答
  •  清歌不尽
    2021-01-25 08:05

    You can now set a background image to stretch to the edges of the container in various ways. If you don't mind the image distorting, you would do it like this:

    background-size: 100% 100%;
    

    Rather than this (which is broken)

    style="style="background:url("img/bg.png") no-repeat fixed center top; width:100%; height:100%;"
    

    try this in your style sheet:

    body {
        background-image:url("img/bg.png");
        background-size: 100% 100%;
    }
    

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