CSS的background-repeat屬性,background-repeat
background-repeat屬性的定義和用法:
設定或檢索對象的背景映像如何鋪排填充。必須先指定background-image屬性。
允許提供2個參數,如果提供全部2個參數,第1個用於橫向,第二個用於縱向。
如果只提供1個參數,則用於橫向和縱向。特殊值repeat-x和repeat-y除外,因為repeat-x相當於repeat no-repeat,repeat-y相當於no-repeat repeat,即其實repeat-x和repeat-y等價於提供了2個參數值。
對應的指令碼特性為backgroundRepeat。
文法結構:
background-repeat:repeat-x | repeat-y | [repeat | space | round | no-repeat
取值:
repeat:背景映像在橫向和縱向平鋪,預設值。
repeat-x:背景映像在橫向上平鋪。
repeat-y:背景映像在縱向上平鋪。
no-repeat:背景映像不平鋪。
round:背景映像自動縮放直到適應且填充滿整個容器。(CSS3)
space:背景映像以相同的間距平鋪且填充滿整個容器或某個方向。(CSS3)
瀏覽器支援:
1.IE8及更早瀏覽器不支援為background-repeat定義2個參數值;不支援CSS3新增參數值round | space。
2.Firefox4.0-8.0不支援為background-repeat定義2個參數值;不支援CSS3新增參數值round | space。
3.Safari5.1已接受CSS3新增參數值round | space,但還未實現支援。 4.Chrome13.0-16.0已接受CSS3新增參數值round | space,但還未實現支援。
繼承性:
無繼承性。
執行個體代碼:
<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="author" content="http://www.51texiao.cn/" /><title>螞蟻部落</title><style type="text/css">.mytest { height:200px; height:200px; background-image:url(mytest/div+css/border.jpg); background-repeat:repeat-x;}</style></head><body><div class="mytest">歡迎來到螞蟻部落</div></body></html>
原文地址是:http://www.51texiao.cn/div_cssjiaocheng/2015/0606/3424.html
最為原始地址是:http://www.softwhy.com/forum.php?mod=viewthread&tid=1346