css问题:background url 后的数字表示什么

来源:百度知道 编辑:UC知道 时间:2024/06/01 17:37:41
定义css里有句代码:

background:url(../images/nav-bg.gif) 0px -32px no-repeat;

问题:后面的两个数字代表什么?说清除点。

background:url(../images/nav-bg.gif) 0px -32px no-repeat;
对应
background:url(路径) top(也就是距容器上边距的距离) left(也就是距容器左边距的距离) 重复方式;
也可以分开写成不同的属性:
background-url:'../images/nav-bg.gif';
background-position:0px -32px;
background-repeat:no-repeat;

你说的是0px和 -32px吗?
我想,0px应该是指该图片与上面的距离是0象素
而-32px,应该是图片与左边的距离把.但不太清楚为什么会有"-"这个符号.

background:url("../images/bg.png") 0 0 no-repeat;
指背景图片地址

两个值就是分别代表x轴和y轴的值,可以理解成背景图片定的位置,你修改那些值就能看到效果了