CSS線條加載動(dòng)畫是一種常用于網(wǎng)頁設(shè)計(jì)的動(dòng)畫,它采用CSS技術(shù)實(shí)現(xiàn),具有簡(jiǎn)單易操作、靈活性高、動(dòng)畫效果出眾等優(yōu)點(diǎn),成為Web開發(fā)者的首選。
/*CSS代碼實(shí)現(xiàn)線條加載動(dòng)畫*/ .loader { display: flex; justify-content: center; align-items: center; width: 100%; height: 100vh; } .line-wrapper { display: flex; justify-content: space-between; align-items: center; width: 60px; height: 60px; } .line { width: 10px; height: 30px; background-color: #000; border-radius: 5px; transform: scaleY(0.5); animation: bounce 0.8s ease-in-out infinite; } .line:nth-of-type(2) { animation-delay: 0.2s; } .line:nth-of-type(3) { animation-delay: 0.4s; } @keyframes bounce { 0% { transform: scaleY(0.5); } 50% { transform: scaleY(1); } 100% { transform: scaleY(0.5); } }
上述代碼實(shí)現(xiàn)了一個(gè)簡(jiǎn)單的線條加載動(dòng)畫,其中類名“l(fā)oader”為包含線條的容器,類名“l(fā)ine-wrapper”是線條容器,類名“l(fā)ine”代表線條。具體動(dòng)畫效果通過CSS關(guān)鍵幀動(dòng)畫實(shí)現(xiàn)。