CSS 请教background-repeat: repeat-x 0 0

来源:百度知道 编辑:UC知道 时间:2024/06/18 09:44:03
0 0 是 什么意思,如果改为0 -50呢,不写话默认是什么(不写话和0 0 的效果不一样)
-
<html>
<head>
<style type="text/css">
body
{
background-image:
url(/bg.gif);
background-repeat: repeat-x 0 0
}
</style>
</head>

<body>
</body>
</html>

首先,上面的写法“background-repeat: repeat-x 0 0”是无效的。
只有这样写“background: repeat-x 0 0”才是有效的。
意思就是背景以X轴(横向)平铺,并且起始平铺的位置是x坐标为0,y坐标为0,就是左上角横向平铺。

如果换成“background: repeat-x 0 -50px”的话就是Y坐标为负的50像素横向平铺。

需要注意的是除0之外所有的数值都要加上单位(比如像素px)。

补充:针对gaosheng1984的回答,background-repeat: repeat-x 0 0;这样的写法是完全错误的!不要误导别人!不信你可以自己试一下,只有background-position才有 0 0这样的坐标控制,而background-repeatv根本没有!!
写在一行只要用background: repeat-x 0 0就可以了!

感谢指正
有两种写法:
1.background-repeat: 0 0
2.background: repeat-x 0 0