8.纯 CSS 创作一个充电 loader 特效
2024-08-27 09:56:18
原文地址:https://segmentfault.com/a/1190000014669547
右边多出来的是 :after 的border
HTML代码:
<div class="battery"></div>
CSS代码:
html, body {
margin:;
padding:;
height: 100%;
display:flex;
justify-content: center;
align-items: center;
/*background: linear-gradient(to bottom, teal, aqua); */
}
.battery{
width: 6em;
height: 3em;
color: midnightblue;
border: 0.5em solid currentColor;
border-radius: 0.2em;
font-size: 2em;
position: relative;
/* 充电颜色 */
background-image: linear-gradient(to right, green, green);
background-repeat: no-repeat;
/* 充电图像大小 */
background-size: 30% 80%;
/* 给内部充电图像定位 */
background-position: top 0.3em left 0.3em;
animation: charge 5s steps(8) infinite;
}
.battery::after{
position: absolute;
content: '';
width: 0.5em;
height: 2em;
background-color: currentColor;
top: 0.5em;
right: -1em;
border-radius: 0 0.2em 0.2em 0;
}
@keyframes charge {
from {
background-size: 10% 80%;
}
to {
background-size: 95% 80%;
}
}
最新文章
- 博弈SG
- node.js使用汇总贴
- Android 主页面顶部栏的通知Notification ,可以自定义通知消息栏的风格,并且点击通知栏进人本程序。
- C# 制作外挂常用的API
- 一步一步学android控件(之二十五)—— SeekBar
- navigationController显示隐藏问题
- VMware vCenter Converter 使用,Error code: 2147549183 (0x8000FFFF) 解决方案
- lightoj 1408 Batting Practice
- 仿ios版微信应用源代码
- VirtualBox 不能为虚拟电脑打开一个新的任务 可能的解决方案
- asp读取指定目录下的文件名
- android BLE Peripheral 模拟 ibeacon 发出ble 广播
- Windows 10的最新版1803版本ISO下载
- eclipse下Spring环境构建及插件
- openssl 交叉编译
- P1734 最大约数和
- 第十章&#160;优先级队列 (xa1)左式堆:结构
- 常见的mysql 进程state<;转自网络>;
- Spring Cloud Zuul与网关中间件
- mac版sublime 无法下载插件(Vue 代码无高亮问题)
热门文章
- Git的一些东西(后续补充)
- 前端学PHP之面向对象系列第四篇-----关键字
- python和linux如何学习一门新的编程语言(python)(python基础结构)
- DS二叉树--左叶子数量
- Temporary ASP.NET Files\root 空间增长太快
- 关于Java大数操作(BigInteger、BigDecimal)
- nginx - 性能优化,突破十万并发
- VBScript Scripting Techniques: File Open Dialog http://www.robvanderwoude.com/vbstech_ui_fileopen.php
- text clf rnn
- 头皮溢脂性皮炎推荐联合治疗:采乐50ml+希尔生100g(请看详情页)维生素B2维生素B6