开发者

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

开发者 https://www.devze.com 2022-12-23 12:47 出处:网络
Setting the background image is clear, bu开发者_如何学运维t how do i set the position for the background-image?The background-position property, e.g.

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

精彩评论

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

关注公众号