久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      CSS3怎么給背景圖片添加動(dòng)態(tài)變色效果

      在之前的文章《利用CSS3創(chuàng)建炫酷的三角背景圖像》中,我們給大家介紹了一種創(chuàng)建炫酷三角背景圖像的方法,感興趣的朋友可以去了解一下~

      而下面本文再給大家介紹一種創(chuàng)建炫酷背景圖像方法,帶大家了解一下如何利用CSS3創(chuàng)建變色背景圖像動(dòng)畫,讓你的網(wǎng)頁更吸引人!

      我們先來看看效果圖

      CSS3怎么給背景圖片添加動(dòng)態(tài)變色效果

      下面我們來研究一下是怎么實(shí)現(xiàn)這個(gè)效果的:

      首先我們不創(chuàng)建標(biāo)簽,直接在body標(biāo)簽上設(shè)置背景圖片

      body {    background-image: url("https://img.php.cn/upload/article/000/000/024/612360451cede816.jpg");   background-size: cover;   background-repeat: no-repeat;   background-attachment: fixed;   background-position: center; }

      CSS3怎么給背景圖片添加動(dòng)態(tài)變色效果

      怎么將圖片變色呢?這就需要在背景圖片上添加一個(gè)顏色層作為覆蓋層,這個(gè)可以利用linear-gradient()函數(shù)實(shí)現(xiàn):

      background-image:             linear-gradient(4deg, rgba(0,255,254,0.3) 50%, rgba(0,255,254,0.3) 100%),    url("https://img.php.cn/upload/article/000/000/024/612360451cede816.jpg");

      CSS3怎么給背景圖片添加動(dòng)態(tài)變色效果

      此時(shí)這個(gè)還是靜態(tài)效果,怎么實(shí)現(xiàn)不斷變色的動(dòng)態(tài)效果?我們可以利用@keyframes和animation屬性來實(shí)現(xiàn)–添加動(dòng)畫效果:

      • 利用animation屬性設(shè)置動(dòng)畫名稱、播放時(shí)間、播放次數(shù)等:

      body {   background-image: url("https://img.php.cn/upload/article/000/000/024/612360451cede816.jpg");   background-size: cover;   background-repeat: no-repeat;   background-attachment: fixed;   background-position: center;   animation-name: background-overlay-animation;   animation-duration: 5s; 	animation-iteration-count: infinite; 	animation-direction: alternate; 	animation-timing-function: linear; }

      animation-name:指定要綁定到選擇器的關(guān)鍵幀的名稱

      animation-duration:動(dòng)畫指定需要多少秒或毫秒完成

      animation-timing-function:設(shè)置動(dòng)畫將如何完成一個(gè)周期

      animation-delay:設(shè)置動(dòng)畫在啟動(dòng)前的延遲間隔。

      animation-iteration-count:定義動(dòng)畫的播放次數(shù)。

      animation-direction:指定是否應(yīng)該輪流反向播放動(dòng)畫。

      animation-fill-mode:規(guī)定當(dāng)動(dòng)畫不播放時(shí)(當(dāng)動(dòng)畫完成時(shí),或當(dāng)動(dòng)畫有一個(gè)延遲未開始播放時(shí)),要應(yīng)用到元素的樣式。

      animation-play-state:指定動(dòng)畫是否正在運(yùn)行或已暫停。

      • 利用@keyframes定義每一幀動(dòng)畫:

      @keyframes background-overlay-animation {   0%   {       background-image:          linear-gradient(4deg, rgba(255,78,36,0.3) 50%, rgba(255,78,36,0.3) 100%),  		url("https://img.php.cn/upload/article/000/000/024/612360451cede816.jpg");   }   25%  {       background-image:           linear-gradient(4deg, rgba(213,49,127,0.3) 50%, rgba(213,49,127,0.3) 100%),  		 url("https://img.php.cn/upload/article/000/000/024/612360451cede816.jpg");   }   50%  {     background-image:         linear-gradient(4deg, rgba(36,182,255,0.3) 50%, rgba(36,182,255,1) 100%),      url("https://img.php.cn/upload/article/000/000/024/612360451cede816.jpg");   }   100% {     background-image:          linear-gradient(4deg, rgba(0,255,254,0.3) 50%, rgba(0,255,254,0.3) 100%),         url("https://img.php.cn/upload/article/000/000/024/612360451cede816.jpg");   } }

      下面給出完整代碼:

      <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style> @keyframes background-overlay-animation {   0%   {       background-image:          linear-gradient(4deg, rgba(255,78,36,0.3) 50%, rgba(255,78,36,0.3) 100%),  		url("https://img.php.cn/upload/article/000/000/024/612360451cede816.jpg");   }   25%  {       background-image:           linear-gradient(4deg, rgba(213,49,127,0.3) 50%, rgba(213,49,127,0.3) 100%),  		 url("https://img.php.cn/upload/article/000/000/024/612360451cede816.jpg");   }   50%  {     background-image:         linear-gradient(4deg, rgba(36,182,255,0.3) 50%, rgba(36,182,255,1) 100%),      url("https://img.php.cn/upload/article/000/000/024/612360451cede816.jpg");   }   100% {     background-image:          linear-gradient(4deg, rgba(0,255,254,0.3) 50%, rgba(0,255,254,0.3) 100%),         url("https://img.php.cn/upload/article/000/000/024/612360451cede816.jpg");   } }  @-webkit-keyframes background-overlay-animation {   /* 兼容谷歌瀏覽器*/   0%   {       background-image:          linear-gradient(4deg, rgba(255,78,36,0.3) 50%, rgba(255,78,36,0.3) 100%)         url("https://img.php.cn/upload/article/000/000/024/612360451cede816.jpg");   }   25%  {       background-image:           linear-gradient(4deg, rgba(213,49,127,0.3) 50%, rgba(213,49,127,0.3) 100%),         url("https://img.php.cn/upload/article/000/000/024/612360451cede816.jpg");   }   50%  {     background-image:         linear-gradient(4deg, rgba(36,182,255,0.3) 50%, rgba(36,182,255,1) 100%),      url("https://img.php.cn/upload/article/000/000/024/612360451cede816.jpg");   }   100% {     background-image:          linear-gradient(4deg, rgba(0,255,254,0.3) 50%, rgba(0,255,254,0.3) 100%),         url("https://img.php.cn/upload/article/000/000/024/612360451cede816.jpg");   } }  body {    background-image: url("https://img.php.cn/upload/article/000/000/024/612360451cede816.jpg");   background-size: cover;   background-repeat: no-repeat;   background-attachment: fixed;   background-position: center;   animation-name: background-overlay-animation;   animation-duration: 5s; 	animation-iteration-count: infinite; 	animation-direction: alternate; 	animation-timing-function: linear; } </style> </head> <body> <!--   你的內(nèi)容放在這里 --> </body> </html>

      PHP中文網(wǎng)平臺有非常多的視頻教學(xué)資源,歡迎大家學(xué)習(xí)《css視頻教程》!

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號