css中 repeat-x 的简单用法

问repeat-x 00 中:

0 0 是 什么意思,如果改为0 -50呢,不写话默认是什么(不写话和0 0  的效果不一样)
- ------
<html>
<head>
<style type="text/css">

body
        {
            margin: 0;
            padding: 0;
            font-size:12px;
            background:#114E87 url(images/tr-bg.jpg) repeat-x;
        }

</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就可以了!

 

 

 

原文地址:https://www.cnblogs.com/gates/p/3158804.html