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 相关文章推荐
css 省略号 css3让多余的字符串消失并附加省略号的实现代码
Feb 07 HTML / CSS
一款纯css3实现的动画加载导航
Oct 08 HTML / CSS
非常漂亮的CSS3百叶窗焦点图动画
Feb 24 HTML / CSS
CSS3实现时间轴效果
Jul 11 HTML / CSS
通过一张图教会你CSS3倒影的实现
Sep 26 HTML / CSS
CSS3 Flex 弹性布局实例代码详解
Nov 01 HTML / CSS
CSS3移动端vw+rem不依赖JS实现响应式布局的方法
Jan 23 HTML / CSS
html5 乒乓球(碰撞检测)实例二
Jul 25 HTML / CSS
HTML5中原生的右键菜单创建方法
Jun 28 HTML / CSS
video下autoplay属性无效的解决方法(添加muted属性)
May 19 HTML / CSS
AmazeUI 网格的实现示例
Aug 13 HTML / CSS
CSS 新特性 contain控制页面的重绘与重排问题
Apr 30 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
解析php中获取系统信息的方法
2013/06/25 PHP
PHP 实现base64编码文件上传出现问题详解
2020/09/01 PHP
javascript实现unicode和字符的互相转换
2007/07/18 Javascript
JavaScript面象对象设计
2008/04/28 Javascript
图片上传判断及预览脚本的效果实例
2013/08/07 Javascript
jquery $.fn $.fx是什么意思有什么用
2013/11/04 Javascript
js和html5实现手机端刮刮卡抽奖效果完美兼容android/IOS
2013/11/18 Javascript
js计算两个时间之间天数差的实例代码
2013/11/19 Javascript
JS实现字体选色板实例代码
2013/11/20 Javascript
Ext4.2的Ext.grid.plugin.RowExpander无法触发事件解决办法
2014/08/15 Javascript
41个Web开发者必须收藏的JavaScript实用技巧
2016/07/22 Javascript
js中 计算两个日期间的工作日的简单实例
2016/08/08 Javascript
详解webpack+angular2开发环境搭建
2017/06/28 Javascript
JSON对象转化为字符串详解
2017/08/11 Javascript
node.js的exports、module.exports与ES6的export、export default深入详解
2017/10/26 Javascript
30分钟快速入门掌握ES6/ES2015的核心内容(下)
2018/04/18 Javascript
基于ionic实现下拉刷新功能
2018/05/10 Javascript
vue展示dicom文件医疗系统的实现代码
2018/08/27 Javascript
小程序实现人脸识别功能(百度ai)
2018/12/23 Javascript
three.js搭建室内场景教程
2018/12/30 Javascript
Vue组件的使用及个人理解与介绍
2019/02/09 Javascript
JavaScript中CreateTextFile函数
2020/08/30 Javascript
vue单元格多列合并的实现
2020/11/26 Vue.js
Python实现朴素贝叶斯的学习与分类过程解析
2019/08/24 Python
python中p-value的实现方式
2019/12/16 Python
Python实现AI换脸功能
2020/04/10 Python
碧欧泉美国官网:Biotherm美国
2016/08/31 全球购物
美国隐形眼镜零售商:LensPure
2019/03/10 全球购物
馥蕾诗美国官网:Fresh美国
2019/10/09 全球购物
上海奥佳笔试题面试题
2016/11/16 面试题
《小山羊和小灰兔》教学反思
2014/02/19 职场文书
亲属关系公证书
2014/04/08 职场文书
自愿解除劳动合同协议书
2014/09/11 职场文书
本科毕业论文导师评语
2014/12/31 职场文书
大学班长竞选稿
2015/11/20 职场文书
MySQL使用IF语句及用case语句对条件并结果进行判断 
2022/09/23 MySQL