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制作文字半透明倒影效果的两种实现方式
Aug 08 HTML / CSS
CSS3 RGBA色彩模式使用实例讲解
Apr 26 HTML / CSS
用HTML5 实现橡皮擦的涂抹效果的教程
May 11 HTML / CSS
使用HTML5 Canvas API绘制弧线的教程
Mar 22 HTML / CSS
html5 初试 indexedDB(推荐)
Jul 21 HTML / CSS
详解H5 活动页之移动端 REM 布局适配方法
Dec 07 HTML / CSS
关于html字符串正则判断和匹配的具体使用
Dec 12 HTML / CSS
HTML5手指下滑弹出负一屏阻止移动端浏览器内置下拉刷新功能的实现代码
Apr 10 HTML / CSS
AmazeUI 列表的实现示例
Aug 17 HTML / CSS
原生CSS实现文字无限轮播的通用方法
Mar 30 HTML / CSS
HTML+CSS+JS实现图片的瀑布流布局的示例代码
Apr 22 HTML / CSS
CSS实现五种常用的2D转换
Dec 06 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 array_search() 函数使用
2010/04/13 PHP
php中使用Imagick实现图像直方图的实现代码
2011/08/30 PHP
PHP入门教程之面向对象的特性分析(继承,多态,接口,抽象类,抽象方法等)
2016/09/11 PHP
workerman结合laravel开发在线聊天应用的示例代码
2018/10/30 PHP
电子商务网站上的常用的js放大镜效果
2011/12/08 Javascript
JavaScript兼容性总结之获取非行间样式案例
2016/08/07 Javascript
JavaScript组合模式学习要点
2016/08/26 Javascript
JS取数字小数点后两位或n位的简单方法
2016/10/24 Javascript
js实现显示手机号码效果
2017/03/09 Javascript
AngularJS实现的select二级联动下拉菜单功能示例
2017/10/25 Javascript
Angular 开发学习之Angular CLI的安装使用
2017/12/31 Javascript
全新打包工具parcel零配置vue开发脚手架
2018/01/11 Javascript
实时监控input框,实现输入框与下拉框联动的实例
2018/01/23 Javascript
vue生成token并保存到本地存储中
2018/07/17 Javascript
Vue+ElementUI使用vue-pdf实现预览功能
2019/11/26 Javascript
[01:22]DOTA2神秘商店携大量周边降临完美大师赛
2017/11/07 DOTA
Python 抓取动态网页内容方案详解
2014/12/25 Python
Python中第三方库Requests库的高级用法详解
2017/03/12 Python
非递归的输出1-N的全排列实例(推荐)
2017/04/11 Python
解决pandas无法在pycharm中使用plot()方法显示图像的问题
2018/05/24 Python
Windows下安装Scrapy
2018/10/17 Python
详解利用OpenCV提取图像中的矩形区域(PPT屏幕等)
2019/07/01 Python
python hmac模块验证客户端的合法性
2020/11/07 Python
python 通过exifread读取照片信息
2020/12/24 Python
MANGO官方网站:西班牙芒果服装品牌
2017/01/15 全球购物
Expedia法国:全球最大在线旅游公司
2018/09/30 全球购物
Coltorti Boutique官网:来自意大利的设计师品牌买手店
2018/11/09 全球购物
Hudson Jeans官网:高级精制牛仔裤
2018/11/28 全球购物
char型变量中能不能存贮一个中文汉字
2015/07/08 面试题
华为c/c++笔试题
2016/01/25 面试题
超市国庆节促销方案
2014/02/20 职场文书
上课看小说检讨书
2014/02/22 职场文书
2015医院个人工作总结范文
2015/05/21 职场文书
js实现上传图片到服务器
2021/04/11 Javascript
一文带你理解vue创建一个后台管理系统流程(Vue+Element)
2021/05/18 Vue.js
Python读写yaml文件
2022/03/20 Python