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实现的漂亮Menu菜单效果代码
Sep 10 HTML / CSS
使用CSS3编写类似iOS中的复选框及带开关的按钮
Apr 11 HTML / CSS
css3实现可拖动的魔方3d效果
May 07 HTML / CSS
网易微博Web App用HTML5开发的过程介绍
Jun 13 HTML / CSS
Bootstrap 学习分享
Nov 12 HTML / CSS
HTML5 离线应用之打造零请求、无流量网站的解决方法
Apr 25 HTML / CSS
一款html5 canvas实现的图片玻璃碎片特效
Sep 11 HTML / CSS
html5使用canvas绘制一张图片
Dec 15 HTML / CSS
一波HTML5 Canvas基础绘图实例代码集合
Feb 28 HTML / CSS
HTML5和CSS3实例教程总结(推荐)
Jul 18 HTML / CSS
canvas如何绘制钟表的方法
Dec 13 HTML / CSS
使用CSS实现按钮边缘跑马灯动画
May 07 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中循环语句的用法介绍
2012/01/30 PHP
php实现点击可刷新验证码
2015/11/07 PHP
浅谈PHP中其他类型转化为Bool类型
2016/03/28 PHP
javascript KeyDown、KeyPress和KeyUp事件的区别与联系
2009/12/03 Javascript
jQuery 顶部导航跟随滚动条滚动固定浮动在顶部
2014/06/06 Javascript
详解AngularJS中的filter过滤器用法
2016/01/04 Javascript
JS组件Bootstrap Table使用实例分享
2016/05/30 Javascript
原生Javascript插件开发实践
2017/01/18 Javascript
使用原生js封装的ajax实例(兼容jsonp)
2017/10/12 Javascript
Vue 组件(component)教程之实现精美的日历方法示例
2018/01/08 Javascript
浅谈ajax在jquery中的请求和servlet中的响应
2018/01/22 jQuery
web页面和微信小程序页面实现瀑布流效果
2018/09/26 Javascript
在Vue中使用icon 字体图标的方法
2019/06/14 Javascript
[03:55]2014DOTA2国际邀请赛 Fnatic经理采访赢DK在情理之中
2014/07/10 DOTA
python和pyqt实现360的CLable控件
2014/02/21 Python
爬山算法简介和Python实现实例
2014/04/26 Python
python 异常处理总结
2016/10/18 Python
python3+PyQt5+Qt Designer实现扩展对话框
2018/04/20 Python
Python 支持向量机分类器的实现
2020/01/15 Python
Python中文分词库jieba,pkusegwg性能准确度比较
2020/02/11 Python
深入理解Tensorflow中的masking和padding
2020/02/24 Python
利用纯CSS3实现tab选项卡切换示例代码
2016/09/21 HTML / CSS
HTML5 Canvas概述
2009/08/26 HTML / CSS
伊利莎白雅顿官网:Elizabeth Arden
2016/10/10 全球购物
英国鞋类及配饰零售商:Kurt Geiger
2017/02/04 全球购物
Mytheresa美国官网:德国知名的女性奢侈品电商
2017/05/27 全球购物
《跨越百年的美丽》教学反思
2014/02/11 职场文书
农民工工资承诺书范文
2014/03/31 职场文书
听课评语大全
2014/04/30 职场文书
庆祝国庆节标语
2014/10/09 职场文书
运动会广播稿200字(10篇)
2014/10/12 职场文书
银行职员工作失误检讨书
2014/10/14 职场文书
读《教育心理学》心得体会
2016/01/22 职场文书
python自动化测试通过日志3分钟定位bug
2021/11/20 Python
Java 关于String字符串原理上的问题
2022/04/07 Java/Android
Python Django / Flask如何使用Elasticsearch
2022/04/19 Python