打开页面时,经常会遇到页面正在加载的情况,作为一个前端工程师,你知道如何用CSS3实现页面加载动画效果吗?这篇文章就和大家分享一个炫酷的圆圈加载动画效果的代码,有一定的参考价值,感兴趣的朋友可以看看。
制作页面加载动画需要用到很多CSS3中的属性,比如:animation属性,position定位,border-radius圆角,transform属性等等,如有不清楚的同学可以看看我以前的文章,之前都有介绍过,或者访问 CSS3视频教程,这些都是基础,一定要掌握。
实例:制作一个圆圈加载动画效果,圆圈在加载时大小由小变大,颜色由浅变深,具体代码如下:
HTML部分:
<div class="loader"> <div class="loading"> <i></i> <i></i> <i></i> <i></i> <i></i> <i></i> <i></i> <i></i> </div> </div>
CSS部分:
.loader{ width: 300px; border: 1px solid #ccc; height: 200px; display: flex; box-sizing: border-box; align-items: center; justify-content: center; } @-webkit-keyframes loading{ 50%{ transform: scale(0.4); opacity: 0.3; } 100%{ transform: scale(1); opacity: 1; } } .loading{ position: relative; } .loading i{ display: block; width: 15px; height: 15px; border-radius: 50%; position: absolute; background: #333; } .loading i:nth-child(1){ top: 25px; left: 0; -webkit-animation: loading 1s ease 0s infinite; } .loading i:nth-child(2){ top: 17px; left: 17px; -webkit-animation: loading 1s ease 0.12s infinite; } .loading i:nth-child(3){ top: 0; left: 25px; -webkit-animation: loading 1s ease 0.24s infinite; } .loading i:nth-child(4){ top: -17px; left: 17px; -webkit-animation: loading 1s ease 0.36s infinite; } .loading i:nth-child(5){ top: -25px; left: 0; -webkit-animation: loading 1s ease 0.48s infinite; } .loading i:nth-child(6){ top: -17px; left: -17px; -webkit-animation: loading 1s ease 0.6s infinite; } .loading i:nth-child(7){ top: 0; left: -25px; -webkit-animation: loading 1s ease 0.72s infinite; } .loading i:nth-child(8){ top: 17px; left: -17px; -webkit-animation: loading 1s ease 0.84s infinite; }
效果图:
以上分享了CSS3实现页面加载动画效果的代码,项目中用的比较多,可以直接拿过去使用,也希望大家可以自己动手尝试,看看自己能不能写出其他的效果,希望这篇文章对你有所帮助!更多相关教程请访问 CSS视频教程
以上是如何用CSS3制作页面圆圈加载动画(附代码)的详细内容。更多信息请关注PHP中文网其他相关文章!

Wufoo一直在集成方面非常出色。他们与特定应用程序(例如广告系列显示器,MailChimp和Typekit)进行集成,但他们也


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

Dreamweaver Mac版
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

SublimeText3 Linux新版
SublimeText3 Linux最新版

WebStorm Mac版
好用的JavaScript开发工具

SecLists
SecLists是最终安全测试人员的伙伴。它是一个包含各种类型列表的集合,这些列表在安全评估过程中经常使用,都在一个地方。SecLists通过方便地提供安全测试人员可能需要的所有列表,帮助提高安全测试的效率和生产力。列表类型包括用户名、密码、URL、模糊测试有效载荷、敏感数据模式、Web shell等等。测试人员只需将此存储库拉到新的测试机上,他就可以访问到所需的每种类型的列表。