CSS3背景動(dòng)畫特效是設(shè)計(jì)師們廣泛使用的一種技巧,它能夠使網(wǎng)頁背景更加生動(dòng)有趣。下面就來介紹一些常見的CSS3背景動(dòng)畫特效。
/* 線性漸變背景動(dòng)畫 */ background: linear-gradient(to bottom, #4b0d9c, #e91e63); background-size: 400% 400%; animation: GradientBG 10s ease infinite; @keyframes GradientBG { 0% { background-position: 0% 0%; } 100% { background-position: 100% 100%; } } /* 徑向漸變背景動(dòng)畫 */ background: radial-gradient(circle, #f8b500, #ff5400); background-size: 400% 400%; animation: GradientBG 10s ease infinite; @keyframes GradientBG { 0% { background-position: 0% 0%; } 100% { background-position: 100% 100%; } } /* CSS3雪花背景動(dòng)畫 */ background-image: url("snowflakes.png"); background-size: 200px 200px; animation: snowflakes 20s linear infinite; @keyframes snowflakes { 0% { background-position: 0 0; } 100% { background-position: 200px 200px; } } /* CSS3水波動(dòng)畫 */ background: #000; background-size: 50px 50px; animation: wave-anim 3s infinite linear; @keyframes wave-anim { 0% { background-position: 0 0; } 100% { background-position: 50px 50px; } } /* CSS3背景圖像縮放動(dòng)畫 */ background: url("image.jpg") no-repeat center center fixed; background-size: cover; animation: zoom-in-out 20s ease-in-out infinite; @keyframes zoom-in-out { 0%, 100% { transform: scale(1); } 50% { transform: scale(2); } }
以上是幾種常見的CSS3背景動(dòng)畫特效的示例。通過這些特效,你可以使網(wǎng)頁更加生動(dòng)有趣,為用戶帶來更好的使用體驗(yàn)。