(1)现在一般都用css设定了,比如在一个div下设背景图片切不让其重复,则可设一个样式,比如:
.nobgrepeat{background:url(背景图片地址) left top no-repeat;}
.nobgrepeat{background:url(背景图片地址) left top no-repeat;}
(2)也可以设置背景图片的高宽,要与背景图片的大小一样
注意:但是有时候加了 no-repeate之后,图片就会不见了,这种情况与设置的 left top 位置有关
.xcConfirm .popBox .ttBox {
width:550px ;
height: 100px ; line-height : 60px;
padding: 14px 30px;
background: url(../images/yezi.png) 35px 20px no-repeat;
}
如果height太小,背景图片后面设置的top太大的话,就会被隐藏在后面,就会看不见
语法:
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; }