开发者

How do i define the position for the background image in css?

Setting the background image is clear, bu开发者_如何学运维t how do i set the position for the background-image?


The background-position property, e.g.

background-position:top right;


if you want a background image with no-repeat positioned 10px to the right and 20px from the top

{ backgroud: url(path to image) no-repeat 10px 20px; }

you can use negative values for the position too, eg. -10px to move it 10px to the left


Or you could use shorthand to set everything at the same time!

background:#ffffff url('/images/background.jpg') top right no-repeat;

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜