当前位置: 首页 > news >正文

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

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

1
2
3
4
5
6
7
8
9
10
11
12
*{
           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.定义标签:

1
2
3
4
5
6
<div class="container">
        <span>Loading...</span>
        <div class="circle">
            <div class="ring"></div>
        </div>
    </div>

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

2. .container的css样式:

1
2
3
4
5
6
.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样式,动画部分可暂时注释掉:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
.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上:

1
2
3
4
5
6
7
8
9
10
.circle::after{
            content: '';
            position: absolute;
            top: 10px;
            left: 10px;
            right: 10px;
            bottom: 10px;
            background-color: rgb(7, 15, 26);
            border-radius: 50%;
        }

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

1
2
3
4
5
6
7
8
9
10
.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%); 渐变颜色,@ www.xuepai.net先蓝色,过渡到透明色。

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
.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; 显示在最上层@ www.haoshilao.net。

7. 定义文本loading:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
.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: 文字阴影。

完整代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!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>

 

http://www.jsqmd.com/news/200608/

相关文章:

  • GLM-4.6V-Flash-WEB模型在智能家居控制中的交互设计
  • GLM-4.6V-Flash-WEB模型支持批量上传图像进行推理吗?
  • GLM-4.6V-Flash-WEB模型能否识别珊瑚礁健康状况?
  • GLM-4.6V-Flash-WEB模型在婚礼摄影智能剪辑中的尝试
  • static函数
  • 酒店客房电视,如何从“背景音”变为“体验加分项”?
  • GLM-4.6V-Flash-WEB模型能否识别冰川湖堤坝稳定性?
  • 【收藏备用】AI大模型学习全攻略:技术与非技术双通道,助大学生快速入局AI领域
  • GLM-4.6V-Flash-WEB模型在沙漠星空摄影指导中的图像分析
  • GLM-4.6V-Flash-WEB模型与知识图谱结合构建智能问答系统
  • GLM-4.6V-Flash-WEB模型能否检测图像中的人物关系?
  • python常见debug
  • 2026本科生必看!8个降AI率工具测评榜单
  • GLM-4.6V-Flash-WEB模型能否识别验证码图片?攻防视角分析
  • GLM-4.6V-Flash-WEB模型能否识别食物种类并估算热量?
  • 亲测好用!9大AI论文平台助力继续教育写作
  • 【必收藏】从小白到入门:大语言模型训练原理解析(ChatGPT原理)
  • GLM-4.6V-Flash-WEB模型能否识别飞鸟种类?观鸟爱好者利器
  • 2026年第一季度书单
  • GLM-4.6V-Flash-WEB模型的日志管理与错误追踪策略
  • 导师推荐!8款AI论文工具测评:本科生毕业论文必备
  • Windows CMD 常用命令操作大全
  • GLM-4.6V-Flash-WEB模型在机场安检图像辅助判读中的设想
  • 康迪科技签约浙江大学,共建智能机器人联合研发中心
  • GLM-4.6V-Flash-WEB模型能否识别古代岩画的文化符号?
  • 从数据库到API:基于Spring Boot与MyBatis的Java敏感数据全链路加密与脱敏实战 - 实践
  • GLM-4.6V-Flash-WEB模型在沙漠铁路沿线巡检中的图像识别
  • GLM-4.6V-Flash-WEB模型能否用于宠物品种识别?
  • GLM-4.6V-Flash-WEB模型中的跨模态推理机制详解
  • 指引上调是什么意思