CSS高效開發實戰:CSS 3、LESS、SASS、Bootstrap、Foundation --讀書筆記(2)CSS3利用圖層疊加實現多背景

來源:互聯網
上載者:User

標籤:css   bootstrap   css3   less   sass   

CSS 3允許設定多個背景圖片,每個背景圖片佔一層,層的上下按照在CSS中書寫的順序來定,最先寫的背景在最上層,每層圖片定義使用英文逗號隔開。

例如下面的代碼:


[html] view plaincopy

  1. background:url(http://dotnet.aspx.cc/Book/Images/CSS1_s.jpg) 0 0 no-repeat,  

  2.   url(http://dotnet.aspx.cc/Book/Images/CSS2_s.jpg) 200px 0 no-repeat,  

  3.  url("http://dotnet.aspx.cc/Book/Images/ASPNET20Book1_s.jpg") 400px 201px no-repeat;  



根據代碼可以看到,每張圖片都可以設定各自的位移、大小、是否重複,如果出現重疊,那麼寫在前面的圖片會覆蓋在最上層。

多背景的效果5.4所示。

650) this.width=650;" src="http://img.blog.csdn.net/20141201113216126?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQva2dzZXc=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" style="border:none;color:rgb(51,51,51);font-family:Arial;font-size:14px;line-height:26px;white-space:normal;background-color:rgb(255,255,255);" />


最後來個書的封面圖吧,有學習的一起交流

650) this.width=650;" src="http://images.cnitblog.com/blog/41113/201411/281416304184854.jpg" style="border:0px;margin:0px;padding:0px;width:884px;" />

650) this.width=650;" src="http://images.cnitblog.com/blog/41113/201411/281417536525494.jpg" style="border:0px;margin:0px;padding:0px;" />


CSS高效開發實戰:CSS 3、LESS、SASS、Bootstrap、Foundation --讀書筆記(2)CSS3利用圖層疊加實現多背景

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.