搜索
首页web前端css教程常见的几种loding效果实现

这次我们来说一下常见的几种loding效果实现,loding效果实现需要注意哪几点,下面就是实战案例,一起来看一下。

<html>
       <head>
              <meta charset="UTF-8">
              <title>Loading</title>
              <link rel="stylesheet" type="text/css" href="loading.css">
              <style>
                     .loader {
                            float: left;
                     }
                    
                     .loader {
                            position: relative;
                            width: 5rem;
                            height: 5rem;
                     }
                    
                     .loader.small {
                            -webkit-transform: scale(.5);
                            transform: scale(.5);
                     }
                    
                     .loader.circle-line,
                     .loader.circle-round {
                            height: 5rem;
                     }
                     /*circle-line*/
                    
                     .loader.circle-line span {
                            position: absolute;
                            display: inline-block;
                            width: 1.5rem;
                            height: .5rem;
                            border-top-left-radius: .25rem;
                            border-bottom-left-radius: .25rem;
                            background: #1ABC9C;
                            opacity: .05;
                            -webkit-animation: circle-line 1s ease infinite;
                            animation: circle-line 1s ease infinite;
                     }
                    
                     .loader.circle-line span:nth-child(1) {
                            top: 50%;
                            left: 0;
                            margin-top: -.25rem;
                            -webkit-animation-delay: .13s;
                            animation-delay: .13s;
                     }
                    
                     .loader.circle-line span:nth-child(2) {
                            top: 1rem;
                            left: .5rem;
                            -webkit-transform: rotate(45deg);
                            transform: rotate(45deg);
                            -webkit-animation-delay: .26s;
                            animation-delay: .26s;
                     }
                    
                     .loader.circle-line span:nth-child(3) {
                            left: 50%;
                            top: .5rem;
                            margin-left: -.75rem;
                            -webkit-transform: rotate(90deg);
                            transform: rotate(90deg);
                            -webkit-animation-delay: .39s;
                            animation-delay: .39s;
                     }
                    
                     .loader.circle-line span:nth-child(4) {
                            right: .5rem;
                            top: 1rem;
                            -webkit-transform: rotate(145deg);
                            transform: rotate(145deg);
                            -webkit-animation-delay: .52s;
                            animation-delay: .52s;
                     }
                    
                     .loader.circle-line span:nth-child(5) {
                            left: 3.5rem;
                            top: 50%;
                            margin-top: -.25rem;
                            -webkit-transform: rotate(180deg);
                            transform: rotate(180deg);
                            -webkit-animation-delay: .65s;
                            animation-delay: .65s;
                     }
                    
                     .loader.circle-line span:nth-child(6) {
                            bottom: 1rem;
                            right: .5rem;
                            -webkit-transform: rotate(-145deg);
                            transform: rotate(-145deg);
                            -webkit-animation-delay: .78s;
                            animation-delay: .78s;
                     }
                    
                     .loader.circle-line span:nth-child(7) {
                            left: 50%;
                            bottom: .5rem;
                            margin-left: -15px;
                            -webkit-transform: rotate(-90deg);
                            transform: rotate(-90deg);
                            -webkit-animation-delay: .91s;
                            animation-delay: .91s;
                     }
                    
                     .loader.circle-line span:nth-child(8) {
                            bottom: 1rem;
                            left: .5rem;
                            -webkit-transform: rotate(-45deg);
                            transform: rotate(-45deg);
                            -webkit-animation-delay: 1.04s;
                            animation-delay: 1.04s;
                     }
                    
                     @keyframes circle-line {
                            0% {
                                   opacity: .05;
                            }
                            100% {
                                   opacity: .7;
                            }
                     }
                    
                     @-webkit-keyframes circle-line {
                            0% {
                                   opacity: .05;
                            }
                            100% {
                                   opacity: .7;
                            }
                     }
                     /*circle-line-spin*/
                    
                     .loader.circle-line-spin .circle-line-inner {
                            width: 100%;
                            height: 100%;
                            -webkit-animation: circle-line-spin 1.5s linear infinite;
                            animation: circle-line-spin 1.5s linear infinite;
                     }
                    
                     .loader.circle-line-spin span {
                            position: absolute;
                            display: inline-block;
                            width: 1.5rem;
                            height: .5rem;
                            border-top-left-radius: .25rem;
                            border-bottom-left-radius: .25rem;
                            background: #1ABC9C;
                            opacity: .7;
                     }
                    
                     .loader.circle-line-spin span:nth-child(1) {
                            top: 50%;
                            left: 0;
                            margin-top: -.25rem;
                     }
                    
                     .loader.circle-line-spin span:nth-child(2) {
                            top: 1rem;
                            left: .5rem;
                            -webkit-transform: rotate(45deg);
                            transform: rotate(45deg);
                     }
                    
                     .loader.circle-line-spin span:nth-child(3) {
                            left: 50%;
                            top: .5rem;
                            margin-left: -.75rem;
                            -webkit-transform: rotate(90deg);
                            transform: rotate(90deg);
                     }
                    
                     .loader.circle-line-spin span:nth-child(4) {
                            right: .5rem;
                            top: 1rem;
                            -webkit-transform: rotate(145deg);
                            transform: rotate(145deg);
                     }
                    
                     .loader.circle-line-spin span:nth-child(5) {
                            left: 3.5rem;
                            top: 50%;
                            margin-top: -.25rem;
                            -webkit-transform: rotate(180deg);
                            transform: rotate(180deg);
                     }
                    
                     .loader.circle-line-spin span:nth-child(6) {
                            bottom: 1rem;
                            right: .5rem;
                            -webkit-transform: rotate(-145deg);
                            transform: rotate(-145deg);
                     }
                    
                     .loader.circle-line-spin span:nth-child(7) {
                            left: 50%;
                            bottom: .5rem;
                            margin-left: -15px;
                            -webkit-transform: rotate(-90deg);
                            transform: rotate(-90deg);
                     }
                    
                     .loader.circle-line-spin span:nth-child(8) {
                            bottom: 1rem;
                            left: .5rem;
                            -webkit-transform: rotate(-45deg);
                            transform: rotate(-45deg);
                     }
                    
                     @keyframes circle-line-spin {
                            0% {
                                   transform: rotate(0);
                            }
                            100% {
                                   transform: rotate(360deg);
                            }
                     }
                    
                     @-webkit-keyframes circle-line-spin {
                            0% {
                                   -webkit-transform: rotate(0);
                            }
                            100% {
                                   -webkit-transform: rotate(360deg);
                            }
                     }
                     /*circle-round*/
                    
                     .loader.circle-round span {
                            opacity: .05;
                            -webkit-animation: circle-round 1s ease infinite;
                            animation: circle-round 1s ease infinite;
                     }
                    
                     .loader.circle-round-fade span {
                            -webkit-animation: circle-round-fade 1s ease infinite;
                            animation: circle-round-fade 1s ease infinite;
                     }
                    
                     .loader.circle-round span,
                     .loader.circle-round-fade span {
                            position: absolute;
                            width: .8rem;
                            height: .8rem;
                            display: inline-block;
                            border-radius: 50%;
                            background: #1ABC9C;
                     }
                    
                     .loader.circle-round span:nth-child(1),
                     .loader.circle-round-fade span:nth-child(1) {
                            top: 50%;
                            left: 0;
                            margin-top: -.4rem;
                            -webkit-animation-delay: -1.04s;
                            animation-delay: -1.04s;
                     }
                    
                     .loader.circle-round span:nth-child(2),
                     .loader.circle-round-fade span:nth-child(2) {
                            top: .7rem;
                            left: .7rem;
                            -webkit-animation-delay: -.91s;
                            animation-delay: -.91s;
                     }
                    
                     .loader.circle-round span:nth-child(3),
                     .loader.circle-round-fade span:nth-child(3) {
                            top: 0;
                            left: 50%;
                            margin-left: -.4rem;
                            -webkit-animation-delay: -.78s;
                            animation-delay: -.78s;
                     }
                    
                     .loader.circle-round span:nth-child(4),
                     .loader.circle-round-fade span:nth-child(4) {
                            right: .7rem;
                            top: .7rem;
                            -webkit-animation-delay: -.65s;
                            animation-delay: -.65s;
                     }
                    
                     .loader.circle-round span:nth-child(5),
                     .loader.circle-round-fade span:nth-child(5) {
                            right: 0;
                            top: 50%;
                            margin-top: -.4rem;
                            -webkit-animation-delay: -.52s;
                            animation-delay: -.52s;
                     }
                    
                     .loader.circle-round span:nth-child(6),
                     .loader.circle-round-fade span:nth-child(6) {
                            bottom: .7rem;
                            right: .7rem;
                            -webkit-animation-delay: -.39s;
                            animation-delay: -.39s;
                     }
                    
                     .loader.circle-round span:nth-child(7),
                     .loader.circle-round-fade span:nth-child(7) {
                            bottom: 0;
                            left: 50%;
                            margin-left: -.4rem;
                            -webkit-animation-delay: -.26s;
                            animation-delay: -.26s;
                     }
                    
                     .loader.circle-round span:nth-child(8),
                     .loader.circle-round-fade span:nth-child(8) {
                            left: .7rem;
                            bottom: .7rem;
                            -webkit-animation-delay: -.13s;
                            animation-delay: -.13s;
                     }
                    
                     @keyframes circle-round {
                            0% {
                                   opacity: .05;
                            }
                            100% {
                                   opacity: .7;
                            }
                     }
                    
                     @-webkit-keyframes circle-round {
                            0% {
                                   opacity: .05;
                            }
                            100% {
                                   opacity: .7;
                            }
                     }
                    
                     @keyframes circle-round-fade {
                            0% {
                                   opacity: .25;
                                   transform: scale(.2);
                            }
                            100% {
                                   opacity: 1;
                                   transform: scale(1);
                            }
                     }
                    
                     @-webkit-keyframes circle-round-fade {
                            0% {
                                   opacity: .25;
                                   transform: scale(.2);
                            }
                            100% {
                                   opacity: 1;
                                   transform: scale(1);
                            }
                     }
                     /*line-square*/
                    
                     .loader.line-square {
                            width: 6rem;
                            height: .8rem;
                     }
                    
                     .loader.line-square span {
                            position: absolute;
                            top: 0;
                            width: .8rem;
                            height: .8rem;
                            display: inline-block;
                            background: #1ABC9C;
                            -webkit-animation: line-square 1s ease infinite;
                            animation: line-square 1s ease infinite;
                     }
                    
                     .loader.line-square span:nth-child(1) {
                            left: 0;
                            -webkit-animation-delay: .13s;
                            animation-delay: .13s;
                     }
                    
                     .loader.line-square span:nth-child(2) {
                            left: 1.3rem;
                            -webkit-animation-delay: .26s;
                            animation-delay: .26s;
                     }
                    
                     .loader.line-square span:nth-child(3) {
                            left: 2.6rem;
                            -webkit-animation-delay: .39s;
                            animation-delay: .39s;
                     }
                    
                     .loader.line-square span:nth-child(4) {
                            left: 3.9rem;
                            -webkit-animation-delay: .52s;
                            animation-delay: .52s;
                     }
                    
                     .loader.line-square span:nth-child(5) {
                            left: 5.2rem;
                            -webkit-animation-delay: .65s;
                            animation-delay: .65s;
                     }
                    
                     @keyframes line-square {
                            0% {
                                   opacity: 1;
                                   transform: scale(1.2);
                                   -webkit-transform: scale(1.2);
                            }
                            100% {
                                   opacity: .2;
                                   transform: scale(.2);
                                   -webkit-transform: scale(.2);
                            }
                     }
                    
                     @-webkit-keyframes line-square {
                            0% {
                                   opacity: 1;
                                   transform: scale(1.2);
                                   -webkit-transform: scale(1.2);
                            }
                            100% {
                                   opacity: .2;
                                   transform: scale(.2);
                                   -webkit-transform: scale(.2);
                            }
                     }
                     /*line-round*/
                    
                     .loader.line-round {
                            width: 6rem;
                            height: .8rem;
                     }
                    
                     .loader.line-round span {
                            position: absolute;
                            top: 0;
                            width: .8rem;
                            height: .8rem;
                            border-radius: 50%;
                            display: inline-block;
                            background: #1ABC9C;
                            -webkit-animation: line-round 1s ease infinite;
                            animation: line-round 1s ease infinite;
                     }
                    
                     .loader.line-round span:nth-child(1) {
                            left: 0;
                            -webkit-animation-delay: .13s;
                            animation-delay: .13s;
                     }
                    
                     .loader.line-round span:nth-child(2) {
                            left: 1.3rem;
                            -webkit-animation-delay: .26s;
                            animation-delay: .26s;
                     }
                    
                     .loader.line-round span:nth-child(3) {
                            left: 2.6rem;
                            -webkit-animation-delay: .39s;
                            animation-delay: .39s;
                     }
                    
                     .loader.line-round span:nth-child(4) {
                            left: 3.9rem;
                            -webkit-animation-delay: .52s;
                            animation-delay: .52s;
                     }
                    
                     .loader.line-round span:nth-child(5) {
                            left: 5.2rem;
                            -webkit-animation-delay: .65s;
                            animation-delay: .65s;
                     }
                    
                     @keyframes line-round {
                            0% {
                                   opacity: 1;
                                   transform: scale(1.2);
                                   -webkit-transform: scale(1.2);
                            }
                            100% {
                                   opacity: .2;
                                   transform: scale(.2);
                                   -webkit-transform: scale(.2);
                            }
                     }
                    
                     @-webkit-keyframes line-round {
                            0% {
                                   opacity: 1;
                                   transform: scale(1.2);
                                   -webkit-transform: scale(1.2);
                            }
                            100% {
                                   opacity: .2;
                                   transform: scale(.2);
                                   -webkit-transform: scale(.2);
                            }
                     }
                     /*line-bounce*/
                    
                     .loader.line-bounce {
                            width: 6rem;
                            height: 2.5rem;
                     }
                    
                     .loader.line-bounce span {
                            position: absolute;
                            top: 0;
                            width: .5rem;
                            height: 2.5rem;
                            border-radius: 5px;
                            display: inline-block;
                            background: #1ABC9C;
                            -webkit-animation: line-bounce 1s ease infinite;
                            animation: line-bounce 1s ease infinite;
                     }
                    
                     .loader.line-bounce span:nth-child(1) {
                            left: 0;
                            -webkit-animation-delay: -.65s;
                            animation-delay: -.65s;
                     }
                    
                     .loader.line-bounce span:nth-child(2) {
                            left: 1.3rem;
                            -webkit-animation-delay: -.78s;
                            animation-delay: -.78s;
                     }
                    
                     .loader.line-bounce span:nth-child(3) {
                            left: 2.6rem;
                            -webkit-animation-delay: -.91s;
                            animation-delay: -.91s;
                     }
                    
                     .loader.line-bounce span:nth-child(4) {
                            left: 3.9rem;
                            -webkit-animation-delay: -.78s;
                            animation-delay: -78s;
                     }
                    
                     .loader.line-bounce span:nth-child(5) {
                            left: 5.2rem;
                            -webkit-animation-delay: -.65s;
                            animation-delay: -.65s;
                     }
                    
                     @keyframes line-bounce {
                            0% {
                                   transform: scaleY(1);
                            }
                            50% {
                                   transform: scaleY(.3);
                            }
                            100% {
                                   transform: scaleY(1);
                            }
                     }
                    
                     @-webkit-keyframes line-bounce {
                            0% {
                                   -webkit-transform: scaleY(1);
                            }
                            50% {
                                   -webkit-transform: scaleY(.3);
                            }
                            100% {
                                   -webkit-transform: scaleY(1);
                            }
                     }
                     /*circle-spin*/
                    
                     .loader.circle-spin {
                            border-radius: 50%;
                            border: .2rem solid rgba(0, 0, 0, .05);
                            width: 4rem;
                            height: 4rem;
                            box-sizing: content-box;
                     }
                    
                     .loader.circle-spin .loader-placeholder {
                            position: absolute;
                            top: -.2rem;
                            left: -.2rem;
                            border-radius: 50%;
                            border: .2rem solid transparent;
                            border-top: .2rem solid #1ABC9C;
                            width: 4rem;
                            height: 4rem;
                            box-sizing: content-box;
                            -webkit-animation: circle-spin 1s ease infinite;
                            animation: circle-spin 1s ease infinite;
                     }
                    
                     @keyframes circle-spin {
                            0% {
                                   transform: rotate(0);
                            }
                            100% {
                                   transform: rotate(360deg);
                            }
                     }
                    
                     @-webkit-keyframes circle-spin {
                            0% {
                                   -webkit-transform: rotate(0);
                            }
                            100% {
                                   -webkit-transform: rotate(360deg);
                            }
                     }
              </style>
       </head>
 
       <body>
              <div>
                     <div class="loader circle-line small">
                            <span></span>
                            <span></span>
                            <span></span>
                            <span></span>
                            <span></span>
                            <span></span>
                            <span></span>
                            <span></span>
                     </div>
                     <div class="loader circle-line-spin small">
                            <div>
                                   <span></span>
                                   <span></span>
                                   <span></span>
                                   <span></span>
                                   <span></span>
                                   <span></span>
                                   <span></span>
                                   <span></span>
                            </div>
                     </div>
                     <div class="loader circle-round small">
                            <span></span>
                            <span></span>
                            <span></span>
                            <span></span>
                            <span></span>
                            <span></span>
                            <span></span>
                            <span></span>
                     </div>
                     <div class="loader circle-round-fade small">
                            <span></span>
                            <span></span>
                            <span></span>
                            <span></span>
                            <span></span>
                            <span></span>
                            <span></span>
                            <span></span>
                     </div>
                     <div class="loader line-square small">
                            <span></span>
                            <span></span>
                            <span></span>
                            <span></span>
                            <span></span>
                     </div>
                     <div class="loader line-round small">
                            <span></span>
                            <span></span>
                            <span></span>
                            <span></span>
                            <span></span>
                     </div>
                     <div class="loader line-bounce small">
                            <span></span>
                            <span></span>
                            <span></span>
                            <span></span>
                            <span></span>
                     </div>
                     <div class="loader circle-spin small">
                            <div></div>
                     </div>
              </div>
 
       </body>
</html>


相信看了这些案例你已经掌握了方法,更多精彩请关注php中文网其它相关文章!

相关阅读:

HTML5响应式banner制作教程

用H5制作水滴特效教程

HTML网页优化压缩的实现步骤

以上是常见的几种loding效果实现的详细内容。更多信息请关注PHP中文网其他相关文章!

声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
@KeyFrames vs CSS过渡:有什么区别?@KeyFrames vs CSS过渡:有什么区别?May 14, 2025 am 12:01 AM

@keyframesandCSSTransitionsdifferincomplexity:@keyframesallowsfordetailedanimationsequences,whileCSSTransitionshandlesimplestatechanges.UseCSSTransitionsforhovereffectslikebuttoncolorchanges,and@keyframesforintricateanimationslikerotatingspinners.

使用页面CMS进行静态站点内容管理使用页面CMS进行静态站点内容管理May 13, 2025 am 09:24 AM

我知道,我知道:有大量的内容管理系统选项可用,而我进行了几个测试,但实际上没有一个是一个,y&#039;知道吗?怪异的定价模型,艰难的自定义,有些甚至最终成为整个&

链接HTML中CSS文件的最终指南链接HTML中CSS文件的最终指南May 13, 2025 am 12:02 AM

链接CSS文件到HTML可以通过在HTML的部分使用元素实现。1)使用标签链接本地CSS文件。2)多个CSS文件可通过添加多个标签实现。3)外部CSS文件使用绝对URL链接,如。4)确保正确使用文件路径和CSS文件加载顺序,优化性能可使用CSS预处理器合并文件。

CSS Flexbox与网格:全面评论CSS Flexbox与网格:全面评论May 12, 2025 am 12:01 AM

选择Flexbox还是Grid取决于布局需求:1)Flexbox适用于一维布局,如导航栏;2)Grid适合二维布局,如杂志式布局。两者在项目中可结合使用,提升布局效果。

如何包括CSS文件:方法和最佳实践如何包括CSS文件:方法和最佳实践May 11, 2025 am 12:02 AM

包含CSS文件的最佳方法是使用标签在HTML的部分引入外部CSS文件。1.使用标签引入外部CSS文件,如。2.对于小型调整,可以使用内联CSS,但应谨慎使用。3.大型项目可使用CSS预处理器如Sass或Less,通过@import导入其他CSS文件。4.为了性能,应合并CSS文件并使用CDN,同时使用工具如CSSNano进行压缩。

Flexbox vs Grid:我应该学习两者吗?Flexbox vs Grid:我应该学习两者吗?May 10, 2025 am 12:01 AM

是的,youshouldlearnbothflexboxandgrid.1)flexboxisidealforone-demensional,flexiblelayoutslikenavigationmenus.2)gridexcelstcelsintwo-dimensional,confffferDesignssignssuchasmagagazineLayouts.3)blosebothenHancesSunHanceSlineHancesLayOutflexibilitibilitibilitibilitibilityAnderibilitibilityAndresponScormentilial anderingStruction

轨道力学(或我如何优化CSS KeyFrames动画)轨道力学(或我如何优化CSS KeyFrames动画)May 09, 2025 am 09:57 AM

重构自己的代码看起来是什么样的?约翰·瑞亚(John Rhea)挑选了他写的一个旧的CSS动画,并介绍了优化它的思维过程。

CSS动画:很难创建它们吗?CSS动画:很难创建它们吗?May 09, 2025 am 12:03 AM

CSSanimationsarenotinherentlyhardbutrequirepracticeandunderstandingofCSSpropertiesandtimingfunctions.1)Startwithsimpleanimationslikescalingabuttononhoverusingkeyframes.2)Useeasingfunctionslikecubic-bezierfornaturaleffects,suchasabounceanimation.3)For

See all articles

热AI工具

Undresser.AI Undress

Undresser.AI Undress

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

AI Clothes Remover

AI Clothes Remover

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

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

Video Face Swap

Video Face Swap

使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

功能强大的PHP集成开发环境

记事本++7.3.1

记事本++7.3.1

好用且免费的代码编辑器

VSCode Windows 64位 下载

VSCode Windows 64位 下载

微软推出的免费、功能强大的一款IDE编辑器

SublimeText3 Linux新版

SublimeText3 Linux新版

SublimeText3 Linux最新版

SublimeText3 英文版

SublimeText3 英文版

推荐:为Win版本,支持代码提示!