CSS3background新增屬性

來源:互聯網
上載者:User

標籤:class   c   ext   http   color   a   

1. background-size

    background-size: cover || contain. 該屬性可以是背景圖片鋪滿容器,前者適用於當背景圖片原始大小小於容器大小,後者適用於圖片尺寸大於容器。

2. background-clip 

  取值 : border-box || padding-box || content-box

    需要注意的是 background在Box Model中,他是布滿整個元素的Box地區的,並不是從padding內部開始,只不過邊框部分遮住了部分background;backgground-color是從左border的左上方到右側border的右下角,而background-image則是從左側padding       的左上方到右側border的右下角。,而webkit下background-clip還有一個更神奇的效果,就是可以讓圖片填充文本,那就是background-clip:text配合其私人屬性-webkit-text-fill-color

    

在前面的基礎上,我們把樣式換一下

   .text {      font-size: 40px;      text-transform: uppercase;      -webkit-background-clip: text;      -webkit-text-fill-color: transparent;   }

效果:

3. background-orgin

   決定背景圖片的起始點。

 

如果background-attachment為fixed的話,background-orign將不會起作用。

  

聯繫我們

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