CSS的background-repeat屬性,background-repeat

來源:互聯網
上載者:User

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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.