css背景與動畫屬性

來源:互聯網
上載者:User

標籤:

background:

background-origin屬性規定background-position屬性相對於什麼位置來定位,而background-clip 屬性規定背景的繪製地區,這兩個要注意區分。

background-image: url(images/red.jpg);background-repeat: no-repeat;background-origin: content-box;background-position: center center;
background-clip:border-box;

  background-size規定映像的大小,該屬性可用來定義動畫。

img:hover {     background-size: 105% 105%;}

  以上屬性都可以用background屬性簡寫。

div{ background: url(images/red.jpg) no-repeat center center;}

  css3還可以增加多個背景,這在以前是只能通過嵌套的方式來實現的。

div{ background: url(images/red.jpg) no-repeat center center, url(images/black.jpg);}

  list-style-type可以定義清單項目標記的類型。

ul{list-style-type:circle;}

  清單項目標記還可以用list-style-image代替,從而用圖片來實現標記。不過這個屬性只能定義一次,因此background屬性更好用。

transform屬性是css3的一個新屬性,可以定義2d或3d轉換。

transform: translate(100px,70px) rotate(90deg) scale(2,4) skew(30deg,40deg);/*位移、旋轉、放大或縮小、翻轉*/

  這幾個屬性要自己去試了才能感受其奧妙,要加動畫效果可以用transition屬性。

div{transition:width 3s ease-in-out 3s;}

  這幾個值分別定義的是動畫名稱、動畫時間長度、動畫速度還有動畫延遲時間。

不過要說定義複雜動畫還是animation更好用。

css背景與動畫屬性

聯繫我們

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