网络学院 w3pop社区 网络资源 IT新闻

w3pop.com :: 网络学院 :: CSS :: CSS background-position属性

会员登陆

帐号

密码

回答

记住密码

忘记密码? 注册

CSS background-position属性


作者:w3pop.com 翻译/整理:w3pop.com 发布:2007-04-28 浏览:2904 :: ::

The background-position property sets the starting position of a background image.
background-position属性可设置背景图像位置

继承性:

举例

body

background-image: url(stars.gif);
background-repeat: no-repeat;
background-position: top left
}

body

background-image: url(stars.gif);
background-repeat: no-repeat;
background-position: 0% 0%
}

可用的值

描述
top left
top center
top right
center left
center center
center right
bottom left
bottom center
bottom right
If you only specify one keyword, the second value will be "center".
如果你只指定了一个关键字,那么第二个值将会是"center"
x-% y-% The first value is the horizontal position and the second value is the vertical. The top left corner is 0% 0%. The right bottom corner is 100% 100%. If you only specify one value, the other value will be 50%.
第一个值影响水平位置,第二个值影响垂直位置。左上角就为0% 0%。右下角则为100% 100%。如果你只指定了其中的一个值,那么另一个值会是50%
x-pos y-pos The first value is the horizontal position and the second value is the vertical. The top left corner is 0 0. Units can be pixels (0px 0px) or any other CSS units. If you only specify one value, the other value will be 50%. You can mix % and positions.
第一个值影响水平位置,第二个值影响垂直位置。左上角就为0 0。单位可以是像素(0px 0px)或是其他的CSS单位。如果你只指定了一个值,那么另一个值会是50%你可以把%和位置名称混合使用。

评论 (0) All