您的位置:首页 > 其它

如何防止网页的背景图片重复 no-repeat

2017-04-21 07:55 323 查看
(1)现在一般都用css设定了,比如在一个div下设背景图片切不让其重复,则可设一个样式,比如:

.nobgrepeat{background:url(背景图片地址) left top no-repeat;}

(2)也可以设置背景图片的高宽,要与背景图片的大小一样

注意:但是有时候加了 no-repeate之后,图片就会不见了,这种情况与设置的 left top  位置有关



[align=left].xcConfirm .popBox .ttBox {[/align]
    
width:550px ;
    height:
100px ;
line-height : 60px;
   
padding: 14px
30px;
   
background: url(../images/yezi.png)
35px
20px
no-repeat;
[align=left]   [/align]
[align=left]    }[/align]
[align=left]
[/align]
[align=left]如果height太小,背景图片后面设置的top太大的话,就会被隐藏在后面,就会看不见[/align]
[align=left]
[/align]
[align=left]
[/align]

语法: 

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

参数: 

repeat :  背景图像在纵向和横向上平铺
no-repeat :  背景图像不平铺
repeat-x :  背景图像在横向上平铺
repeat-y :  背景图像在纵向平铺 

说明: 

设置或检索对象的背景图像是否及如何铺排。必须先指定对象的背景图像。 
对应的脚本特性为backgroundRepeat。请参阅我编写的其他书目。 

示例: 

menu { background: url("images/aardvark.gif"); background-repeat: repeat-y; } 
p { background: url("images/aardvark.gif"); background-repeat: no-repeat; }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: