HTML background image offset by x pixels from the center

后端 未结 9 1362

I\'d like to put an image as the background of a webpage but have it offset by some number of pixels with respect to the center.

How can I do this?

I want:

9条回答
  •  甜味超标
    2020-12-23 09:26

    My answer gotta be too late but somehow I've found another solution.

    padding-left: 100px; /* offset you need */
    padding-right: 100%;
    

    or

    padding-right: 100px;
    padding-left: 100%;
    

    The examples have the same effect.

提交回复
热议问题