html+css实现环绕倒影加载特效


Posted in HTML / CSS onJuly 07, 2021

本文主要介绍了html+css实现环绕倒影加载特效,具体如下:

先看效果(完整代码在底部):

html+css实现环绕倒影加载特效

实现(可一步一步边看效果边编写):

※先初始化(直接复制):

*{
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
 body{
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            background-color: rgb(7, 15, 26);
        }

flex布局,让子元素居中对齐。

1.定义标签:

<div class="container">
        <span>Loading...</span>
        <div class="circle">
            <div class="ring"></div>
        </div>
    </div>

.container是最底层盒子。
span是文本。
.circle是底层圆形盒子。
.ring是那个蓝色环。

2. .container的css样式:

.container{
            position: relative;
            height: 150px;
            width: 250px;
            -webkit-box-reflect:below 1px linear-gradient(transparent  ,rgb(7, 15, 26));
        }

-webkit-box-reflect:该属性能实现倒影特效。详细。

3. .circle的css样式,动画部分可暂时注释掉:

.circle{
            position: relative;
            margin: 0 auto;
            height: 150px;
            width: 150px;
            background-color: rgb(13, 10, 37);
            border-radius: 50%;
            animation: zhuan 2s linear infinite;
        }
        @keyframes zhuan{
            0%{ 
               
                transform: rotate(0deg);
            }
            100%{
                
                 transform: rotate(360deg);
            }
        }

margin: 0 auto;居中。
border-radius: 50%; 角弧度。
animation: zhuan 2s linear infinite; 设置动画,让其旋转。
transform: rotate(…deg); 旋转角度。

4. 定义一个双伪类,为一个与背景色相同的小圆,覆盖在.circle上:

.circle::after{
            content: '';
            position: absolute;
            top: 10px;
            left: 10px;
            right: 10px;
            bottom: 10px;
            background-color: rgb(7, 15, 26);
            border-radius: 50%;
        }

5.定义蓝色环形效果,因为被第4步的小圆覆盖了,所以直接定义一个渐变的蓝色圆形即可得到蓝色环形:

.ring{
            position: absolute;
            top: 0;
            left: 0;
            width: 75px;
            height: 150px;
            background-image: linear-gradient(180deg,rgb(22, 121, 252) ,transparent 80%);
            border-radius: 75px 0 0 75px;
            
        }

background-image: linear-gradient(180deg,rgb(22, 121, 252) ,transparent 80%); 渐变颜色,先蓝色,过渡到透明色。

6.定义环形上发光的小圆球:

.ring::after{
            content: '';
            position: absolute;
            right: -5px;
            top: -2.5px;
            width: 15px;
            height: 15px;
            background-color: rgb(40, 124, 202);
            box-shadow: 0 0 5px rgb(40, 151, 202),
            0 0 10px rgb(40, 124, 202),
            0 0 20px rgb(40, 124, 202),
            0 0 30px rgb(40, 124, 202),
            0 0 40px rgb(40, 124, 202),
            0 0 50px rgb(40, 124, 202),
            0 0 60px rgb(40, 124, 202),
            0 0 60px rgb(40, 124, 202);
            border-radius: 50%;
            z-index: 1;
            
        }

box-shadow: 阴影。
z-index: 1; 显示在最上层。

7. 定义文本loading:

.container>span{
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%,-50%);
            color: rgb(20, 129, 202);
            text-shadow: 0 0 10px rgb(20, 129, 202),
            0 0 30px rgb(20, 129, 202),
            0 0 60px rgb(20, 129, 202),
            0 0 100px rgb(20, 129, 202);
            font-size: 18px;
            z-index: 1;
       
        }

left: 50%;
top: 50%;
transform: translate(-50%,-50%); 居中对齐。
text-shadow: 文字阴影。

完整代码:

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        body{
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            background-color: rgb(7, 15, 26);
        }
        .container{
            position: relative;
            height: 150px;
            width: 250px;
            -webkit-box-reflect:below 1px linear-gradient(transparent  ,rgb(7, 15, 26));
        }
        .container>span{
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%,-50%);
            color: rgb(20, 129, 202);
            text-shadow: 0 0 10px rgb(20, 129, 202),
            0 0 30px rgb(20, 129, 202),
            0 0 60px rgb(20, 129, 202),
            0 0 100px rgb(20, 129, 202);
            font-size: 18px;
            z-index: 1;
       
        }     
        .circle{
            position: relative;
            margin: 0 auto;
            height: 150px;
            width: 150px;
            background-color: rgb(13, 10, 37);
            border-radius: 50%;
            animation: zhuan 2s linear infinite;
        }
        @keyframes zhuan{
            0%{ 
               
                transform: rotate(0deg);
            }
            100%{
                
                 transform: rotate(360deg);
            }
        }
        .circle::after{
            content: '';
            position: absolute;
            top: 10px;
            left: 10px;
            right: 10px;
            bottom: 10px;
            background-color: rgb(7, 15, 26);
            border-radius: 50%;
        }
        
        .ring{
            position: absolute;
            top: 0;
            left: 0;
            width: 75px;
            height: 150px;
            background-image: linear-gradient(180deg,rgb(22, 121, 252) ,transparent 80%);
            border-radius: 75px 0 0 75px;
            
        }
        
        .ring::after{
            content: '';
            position: absolute;
            right: -5px;
            top: -2.5px;
            width: 15px;
            height: 15px;
            background-color: rgb(40, 124, 202);
            box-shadow: 0 0 5px rgb(40, 151, 202),
            0 0 10px rgb(40, 124, 202),
            0 0 20px rgb(40, 124, 202),
            0 0 30px rgb(40, 124, 202),
            0 0 40px rgb(40, 124, 202),
            0 0 50px rgb(40, 124, 202),
            0 0 60px rgb(40, 124, 202),
            0 0 60px rgb(40, 124, 202);
            border-radius: 50%;
            z-index: 1;
            
        }
      
    </style>
</head>
<body>
    <div class="container">
        <span>Loading...</span>
        <div class="circle">
            <div class="ring"></div>
        </div>
    </div>
</body>
</html>

总结:

到此这篇关于html+css实现环绕倒影加载特效的文章就介绍到这了,更多相关html+css环绕倒影加载内容请搜索三水点靠木以前的文章或继续浏览下面的相关文章,希望大家以后多多支持三水点靠木!

 
HTML / CSS 相关文章推荐
CSS3中的5个有趣的新技术
Apr 02 HTML / CSS
CSS3 完美实现圆角效果
Jul 13 HTML / CSS
使用JS+CSS3技术:让你的名字动起来
Apr 27 HTML / CSS
利用CSS3动画实现圆圈由小变大向外扩散的效果实例
Sep 10 HTML / CSS
详解css3中 text-fill-color属性
Jul 08 HTML / CSS
css3遮罩层镂空效果的多种实现方法
May 11 HTML / CSS
HTML5制作酷炫音频播放器插件图文教程
Dec 30 HTML / CSS
利用HTML5绘制点线面组成的3D图形的示例
May 12 HTML / CSS
HTML5中的强制下载属性download使用实例解析
May 12 HTML / CSS
html5唤醒APP小记
Mar 27 HTML / CSS
详解HTML5 Canvas标签及基本使用
Jan 10 HTML / CSS
使用iframe+postMessage实现页面跨域通信的示例代码
Jan 14 HTML / CSS
html5表单的required属性使用
Jul 07 #HTML / CSS
html输入两个数实现加减乘除功能
Jul 01 #HTML / CSS
详解overflow:hidden的作用(溢出隐藏、清除浮动、解决外边距塌陷)
关于CSS浮动与取消浮动的问题
html5调用摄像头实例代码
Jun 28 #HTML / CSS
CSS 伪元素::marker详解
深入理解margin塌陷和margin合并的解决方案
You might like
绿山咖啡和蓝山咖啡
2021/03/04 新手入门
支持oicq头像的留言簿(一)
2006/10/09 PHP
优化PHP程序的方法小结
2012/02/23 PHP
ThinkPHP3.0略缩图不能保存到子目录的解决方法
2012/09/30 PHP
PHP邮件发送类PHPMailer用法实例详解
2014/09/22 PHP
php中实现进程锁与多进程的方法
2016/09/18 PHP
基于逻辑运算的简单权限系统(实现) JS 版
2007/03/24 Javascript
基于jquery实现拆分姓名的方法(纯JS版)
2013/05/08 Javascript
Jquery通过Ajax方式来提交Form表单的具体实现
2013/11/07 Javascript
JQuery 图片滚动轮播示例代码
2014/03/24 Javascript
JavaScript实现的多种鼠标拖放效果
2015/11/03 Javascript
详解Vue.js动态绑定class
2016/12/20 Javascript
JS分页的实现(同步与异步)
2017/09/16 Javascript
vue 中directive功能的简单实现
2018/01/05 Javascript
Angularjs之如何在跨域请求中传输Cookie的方法
2018/06/01 Javascript
vue使用jsonp抓取qq音乐数据的方法
2018/06/21 Javascript
JavaScript面向对象继承原理与实现方法分析
2018/08/09 Javascript
基于three.js实现的3D粒子动效实例代码
2019/04/09 Javascript
javascript使用substring实现的展开与收缩文字功能示例
2019/06/17 Javascript
jquery.pager.js分页实现详解
2019/07/29 jQuery
[02:53]2018年度DOTA2最佳战队-完美盛典
2018/12/17 DOTA
python虚拟环境virtualenv的使用教程
2017/10/20 Python
python实现两个一维列表合并成一个二维列表
2019/12/02 Python
python re模块匹配贪婪和非贪婪模式详解
2020/02/11 Python
python统计函数库scipy.stats的用法解析
2020/02/25 Python
Python脚本破解压缩文件口令实例教程(zipfile)
2020/06/14 Python
python把一个字符串切开的实例方法
2020/09/27 Python
基于Python模拟浏览器发送http请求
2020/11/06 Python
程序员跳槽必看面试题总结
2013/06/28 面试题
幼儿园国庆节活动方案
2014/02/01 职场文书
幼儿园教师获奖感言
2014/03/11 职场文书
机关会计岗位职责
2014/04/08 职场文书
质量承诺书怎么写
2014/05/24 职场文书
客户答谢会活动方案
2014/08/31 职场文书
催款律师函范文
2015/05/27 职场文书
Python趣味挑战之给幼儿园弟弟生成1000道算术题
2021/05/28 Python