css3動畫之背景顏色的自動切換

來源:互聯網
上載者:User

標籤:

因為不同瀏覽器核心的不同所以會產生瀏覽器安全色性問題

  1 <!DOCTYPE html>  2 <html>  3 <head>  4     <meta charset=‘utf-8‘/>  5     <title>背景顏色的變換</title>  6 <style type="text/css">  7 div{  8     width: 200px;  9     height: 200px; 10     background: blue; 11     animation:myfirst 5s; 12     -moz-animation:myfirst 5s;  /*Firefox裡面*/ 13     -webkit-animation:myfirst 5s;  /*Google和safair裡面*/ 14     -o-animation:myfirst 5s; /*歐朋瀏覽器*/ 15 } 16 /*Firefox裡面*/ 17 @-moz-keyframes myfirst{ 18     0%{background: blue} 19     25%{background: red} 20     50%{background: yellow} 21     100%{background: green} 22 } 23 /*Google和Safari裡面*/ 24 @-webkit-keyframes myfirst{ 25     0%{background: blue} 26     25%{background: red} 27     50%{background: yellow} 28     100%{background: green}     29 } 30 /*歐朋瀏覽器*/ 31 @-o-keyframes myfirst{ 32     0%{background: blue} 33     25%{background: red} 34     50%{background: yellow} 35     100%{background: green} 36 } 37 </style> 38 </head> 39 <body> 40 <div><h1>內容是什麼</h1></div> 41 </body> 42 </html> 43  44  45  46  47 <!-- <!DOCTYPE html> 48 <html> 49 <head> 50 <style>  51 div 52 { 53 width:200px; 54 height:200px; 55 background:red; 56 animation:myfirst 5s; 57 -moz-animation:myfirst 5s; /* Firefox */ 58 -webkit-animation:myfirst 5s; /* Safari and Chrome */ 59 -o-animation:myfirst 5s; /* Opera */ 60 } 61  62 @keyframes myfirst 63 { 64 0%   {background:red;} 65 25%  {background:yellow;} 66 50%  {background:blue;} 67 100% {background:green;} 68 } 69  70 @-moz-keyframes myfirst /* Firefox */ 71 { 72 0%   {background:red;} 73 25%  {background:yellow;} 74 50%  {background:blue;} 75 100% {background:green;} 76 } 77  78 @-webkit-keyframes myfirst /* Safari and Chrome */ 79 { 80 0%   {background:red;} 81 25%  {background:yellow;} 82 50%  {background:blue;} 83 100% {background:green;} 84 } 85  86 @-o-keyframes myfirst /* Opera */ 87 { 88 0%   {background:red;} 89 25%  {background:yellow;} 90 50%  {background:blue;} 91 100% {background:green;} 92 } 93 </style> 94 </head> 95 <body> 96  97 <div></div> 98  99 <p><b>注釋:</b>當動畫完成時,會變回初始的樣式。</p>100 101 <p><b>注釋:</b>本例在 Internet Explorer 中無效。</p>102 103 </body>104 </html>105  -->

備忘部分是w3school上面的例子

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.