CSS background-repeat 属性

css background-repeat 属性用于设置如何平铺对象的 background-image 属性

默认情况下,重复 background-image 的垂直和水平方向

background-position 属性设置背景图像位置,如果指定的位置是没有任何背景,图像总是放在元素的左上角
默认值repeat
继承no
版本CSS1
JavaScript 语法object.style.backgroundRepeat="repeat-y"

浏览器支持

IE8 以及更早版本的浏览器不支持多个背景图像在一个元素

IE7 和更早的版本不支持"inherit(继承)"的值

IE8 需要定义 <!DOCTYPE html>

IE9 支持 "inherit(继承)"


语法

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

属性值

说明
repeat背景图像将向垂直和水平方向重复。这是默认
repeat-x只有水平位置会重复背景图像
repeat-y只有垂直位置会重复背景图像
no-repeatbackground-image不会重复
inherit指定background-repea属性设置应该从父元素继承

范例

只有垂直方向重复 background-image

body {
    background-image:url('/static/i/css/paper.gif');
    background-repeat:repeat-y;
}

本文内容仅供个人学习/研究/参考使用,不构成任何决策建议或专业指导。分享/转载时请标明原文来源,同时请勿将内容用于商业售卖、虚假宣传等非学习用途哦~感谢您的理解与支持!

链接: https://fly63.com/course/6_285

目录选择