纯css进度条,简单美观实用。

css

css 复制代码
    .card-progress-bar{
        width: 80%;
    }
    .bar{
        height: 20px;
        width: 90%;
        background-color: #D7E4EF;
    }
    .bar::before{
        display: block;
        counter-reset: progress var(--precent);
        content: counter(progress) '%';
        width: calc(1% * var(--precent));
        color: #D7E4EF;
        background-color: #4193F7;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
    }

html:在style里给 "--precent"赋值,就能显示对应百分比。

html 复制代码
       <div class="card-progress-bar">
          <div class="bar" style="--precent:93;"></div>
      </div>
相关推荐
Nan_Shu_61416 分钟前
学习: Threejs (2)
前端·javascript·学习
G_G#24 分钟前
纯前端js插件实现同一浏览器控制只允许打开一个标签,处理session变更问题
前端·javascript·浏览器标签页通信·只允许一个标签页
@大迁世界39 分钟前
TypeScript 的本质并非类型,而是信任
开发语言·前端·javascript·typescript·ecmascript
GIS之路1 小时前
GDAL 实现矢量裁剪
前端·python·信息可视化
是一个Bug1 小时前
后端开发者视角的前端开发面试题清单(50道)
前端
Amumu121381 小时前
React面向组件编程
开发语言·前端·javascript
持续升级打怪中1 小时前
Vue3 中虚拟滚动与分页加载的实现原理与实践
前端·性能优化
GIS之路1 小时前
GDAL 实现矢量合并
前端
hxjhnct1 小时前
React useContext的缺陷
前端·react.js·前端框架
前端 贾公子2 小时前
从入门到实践:前端 Monorepo 工程化实战(4)
前端