用@keyframes(动画),实现页面加载时的div动画(不要用js控制,因为当页面加载的时候,js还不一定可以使用)
可以在https://daneden.github.io/animate.css/参考所需要的动画效果
div{ opacity:0; } @keyframes fadeInLeft { from { opacity: 0; transform: translate3d(-100%, 0, 0); } to { opacity: 1; transform: translate3d(0, 0, 0); } } @-webkit-keyframes fadeInLeft { from { opacity: 0; transform: translate3d(-10%, 0, 0); } to { opacity: 1; transform: translate3d(0, 0, 0); } } .fadeInLeft { animation: fadeInLeft .3s forwards; }
<div class="fadeInLeft">kkdkkdkdkkdkdkkdk</div>
原文地址:https://www.cnblogs.com/rachelch/p/8405579.html
时间: 2024-10-11 00:17:17