background-repeat:repeat这个在CSS里是什么意思

background-repeat:repeat
重复背景图片这个怎么加了和没加效果一样,看不出来什么差别啊?

意思是当盒子的大小大于一张背景图得大小时,剩余空白的地方要不套继续用这张图片去填充,repeat就是重复填充,no-repeat则只使用一次图片
温馨提示:答案为网友推荐,仅供参考
第1个回答  2017-09-21

在CSS中,background-repeat 属性设置是否及如何重复背景图像。

示例代码:

<html>
<head>
<meta charset="utf-8"> 
<title>示例</title>
<style>
body
{
background-image:url('paper.gif');
background-repeat:inherit;//repeat,repeat-x,repeat-y,no-repeat
}
</style>
</head>

<body>
<p>inherit</p>
</body>
</html>

1、background-repeat:repeat 是默认属性,使背景图像在水平和垂直方向上重复。

2、background-repeat:repeat-x 背景图像将在水平方向重复。  

3、background-repeat:repeat-y 背景图像将在垂直方向重复。  

4、background-repeat:no-repeat 背景图像将仅显示一次。   


5、background-repeat:inherit 规定应该从父元素继承 background-repeat      属性的设置。

第2个回答  2013-08-18
repeat就是重复的意思,背景默认就是整个页面重复的你又设置它为重复的当然没用!
background-repeat: 后面的属性可以是
repeat  背景图像在纵向和横向上平铺
no-repeat  背景图像不平铺
repeat-x  背景图像在横向上平铺
repeat-y  背景图像在纵向平铺
第3个回答  2017-09-07
背景图片将会在水平和垂直两个方向都重复,这个是background-repeat属性的默认值。
第4个回答  2017-07-18
repeat是重复的意思
background-repeat:repeat
是让背景图片重复平铺
而在css中背景图片默认就是repeat
重复的
所以你加了
background-repeat:repeat
和没加是一样的