纯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>
相关推荐
|晴 天|5 小时前
Vue 3 + TypeScript + Element Plus 博客系统开发总结与思考
前端·vue.js·typescript
猫3286 小时前
v-cloak
前端·javascript·vue.js
旷世奇才李先生6 小时前
Vue 3\+Vite\+Pinia实战:企业级前端项目架构设计
前端·javascript·vue.js
SoaringHeart8 小时前
Flutter进阶:用OverlayEntry 实现所有弹窗效果
前端·flutter
IT_陈寒9 小时前
Vite静态资源加载把我坑惨了
前端·人工智能·后端
herinspace9 小时前
管家婆实用贴-如何分离和附加数据库
开发语言·前端·javascript·数据库·语音识别
小码哥_常10 小时前
从MVC到MVI:一文吃透架构模式进化史
前端
嗷o嗷o10 小时前
Android BLE 的 notify 和 indicate 到底有什么区别
前端
豹哥学前端10 小时前
别再背“var 提升,let/const 不提升”了:揭开暂时性死区的真实面目
前端·面试
lar_slw10 小时前
k8s部署前端项目
前端·容器·kubernetes