css里repeat-x啥意思

html-css07

css里repeat-x啥意思,第1张

repeat-x是横向铺满,是css里background的一种属性,代表图片向水平平铺。

比如导航条,水平方向色块颜色是一致的。那切图的时候就可以纵向切一小块命名为nav.jpg。然后定义css,代码如下:

.nav{background:url(./images/nav.jpg) repeat-xheight:35px}

repeat-x是横向铺满,就是在#header.nav-box中,图片nav-box-bg.gif会横向重复,直到铺满。

repeat-y是纵向,就是在#header.nav-box中,图片nav-box-bg.gif会竖向重复,直到铺满。

如果想要横轴和竖轴都平铺的话,直接用background-repeat:repeat就可以了。

扩展资料:

css参考函数

attr() 返回所选元素的属性值

hsl() 使用Hue-Saturation-Lightness模型(HSL)定义颜色

hsla() 使用Hue-Saturation-Lightness-Alpha模型(HSLA)定义颜色

linear-gradient() 将线性渐变设置为背景图像。 定义至少两种颜色(从上到下)

radial-gradient() 将径向渐变设置为背景图像。 定义至少两种颜色(中心到边缘)

参考资料来源:百度百科-CSS (层叠样式表)

background-position:bottom

background-image:url(image/head_02.png)

background-repeat:repeat-x

background-attachment:fixed

写成background:url(image/head_02.png) repeat-x bottom