摘要:分享一例CSS3做的酷狗音乐的动态效果.
分享一例CSS3做的酷狗音乐的动态效果.
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>CSS3酷狗音乐的动态效果</title> <style> *{ margin: 0; padding: 0; box-sizing: border-box; } body{ background: #ccc; } .box{ margin: 150px auto; width: 174px; height: 100px; background: #000; overflow: hidden; } .box > div{ margin-right: 6px; width: 30px; height: 100px; background: #FF7F50; float: left; -webkit-animation-name: move; animation-name: move; -webkit-animation-iteration-count: infinite; animation-iteration-count: infinite; -webkit-animation-duration: .5s; animation-duration: .5s; } .box > div:last-child{ margin-right: 0; } .one{ -webkit-animation-delay: .2s; animation-delay: .2s; } .two{ -webkit-animation-delay: .3s; animation-delay: .3s; } .three{ -webkit-animation-delay: .4s; animation-delay: .4s; } .four{ -webkit-animation-delay: .5s; animation-delay: .5s; } .five{ -webkit-animation-delay: .6s; animation-delay: .6s; } @keyframes move{ 0{ -webkit-transform: translateY(0); transform: translateY(0); } 50%{ -webkit-transform: translateY(100px); transform: translateY(100px); } 100%{ -webkit-transform: translateY(0); transform: translateY(0); } } @-webkit-keyframes move{ 0{ -webkit-transform: translateY(0); transform: translateY(0); } 50%{ -webkit-transform: translateY(100px); transform: translateY(100px); } 100%{ -webkit-transform: translateY(0); transform: translateY(0); } } </style> </head> <body> <div class="box"> <div class="one"></div> <div class="two"></div> <div class="three"></div> <div class="four"></div> <div class="five"></div> </div> </body> </html>
网友评论:
2017-04-01 11:05:04 回复