使用css实现从左侧弹入的动画效果,您可以尝试运行以下代码 −
示例实时演示
<html> <head> <style> .animated { background-image: url(/css/images/logo.png); background-repeat: no-repeat; background-position: left top; padding-top:95px; margin-bottom:60px; -webkit-animation-duration: 10s; animation-duration: 10s; -webkit-animation-fill-mode: both; animation-fill-mode: both; } @-webkit-keyframes bounceinleft { 0% { opacity: 0; -webkit-transform: translatex(-2000px); } 60% { opacity: 1; -webkit-transform: translatex(30px); } 80% { -webkit-transform: translatex(-10px); } 100% { -webkit-transform: translatex(0); } } @keyframes bounceinleft { 0% { opacity: 0; transform: translatex(-2000px); } 60% { opacity: 1; transform: translatex(30px); } 80% { transform: translatex(-10px); } 100% { transform: translatex(0); } } .bounceinleft { -webkit-animation-name: bounceinleft; animation-name: bounceinleft; } </style> </head> <body> <div id="animated-example" class="animated bounceinleft"></div> <button onclick="myfunction()">reload page</button> <script> function myfunction() { location.reload(); } </script> </body></html>
以上就是使用 css 向左弹跳动画效果的详细内容。