1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 如何用CSS3制作页面圆圈加载动画(code)

如何用CSS3制作页面圆圈加载动画(code)

时间:2022-12-24 02:09:14

相关推荐

如何用CSS3制作页面圆圈加载动画(code)

web前端|css教程

CSS3,加载动画

web前端-css教程

打开页面时,经常会遇到页面正在加载的情况,作为一个前端工程师,你知道如何用CSS3实现页面加载动画效果吗?这篇文章就和大家分享一个炫酷的圆圈加载动画效果的代码,有一定的参考价值,感兴趣的朋友可以看看。

投票任务 源码,ubuntu怎样升级软件,爬虫功能的网站,显示php,编辑seo面试lzw

制作页面加载动画需要用到很多CSS3中的属性,比如:animation属性,position定位,border-radius圆角,transform属性等等,如有不清楚的同学可以看看我以前的文章,之前都有介绍过,或者访问 CSS3视频教学,这些都是基础,一定要掌握。

企业介绍小程序源码,ubuntu1604+主题,tomcat配置和调优,爬虫 博客 图表,在线学习系统php交流,seo净化lzw

实例:制作一个圆圈加载动画效果,圆圈在加载时大小由小变大,颜色由浅变深,具体代码如下:

织梦报名源码,ubuntu支持微信,tomcat7插件下载失败,现有网络爬虫比较,php 微信清粉源码,专业seo维护lzw

HTML部分:

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视频教学

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。