background-repeat

2022-10-22,

■ 定义

background-repeat属性用于定义是否及如何对背景图像进行平铺

■ 使用说明

语法:

background-image: repeat | no-repeat | repeat-x | repeat-y ;

属性值:

  repeat:沿着x轴和y轴平铺(默认)

  no-repeat:不平铺

  repeat-x:沿着x轴平铺

  repeat-y:沿着y轴平铺

背景平铺可以添加背景颜色,只不过背景图片会压住背景颜色

■ 示例

div {
    width: 100px;
    height: 100px;
    background-image: url(images/logo.png);
    background-repeat: no-repeat;
}

《background-repeat.doc》

下载本文的Word格式文档,以方便收藏与打印。