纯css实现环形进度条

需要在中实现一个定制化的环形进度条,最终效果如图:

使用代码

html 复制代码
 <div
                    class="circular-progress"
                    :style="{
                      '--progress': nextProgress,
                      '--color': endSliderColor,
                      '--size': isFull ? '60rpx' : '90rpx',
                    }"
                  >
                    <div class="inner-content">
                      <img
                        :class="isFull ? 'next_btn_full' : 'next_btn_normal'"
                         :src="`${assetsHost}dsplayer/next.png`"
                        alt=""
                      />
                    </div>
                  </div>

css代码:

css 复制代码
/* 内层遮罩实现环形效果 */
.circular-progress::before {
  content: "";
  position: absolute;
  width: 80%;
  height: 80%;
  background: rgba(0, 0, 0, 1);
  border-radius: 50%;
}

.inner-content {
  position: relative;
  z-index: 1;
  font-size: 1.2em;
  color: var(--color);
}

/* 兼容方案(可选) */
@supports not (background: conic-gradient(#000, #fff)) {
  .circular-progress {
    background: var(--bg-color);
  }

  .circular-progress::after {
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    clip: rect(0, var(--size), var(--size), calc(var(--size) / 2));
    background: var(--color);
    transform: rotate(calc(var(--progress) * 3.6deg));
  }
}
相关推荐
iCoding9115 小时前
前端分页 vs 后端分页:技术选型
前端·后端·系统架构
mingtianyihou3315 小时前
使用 Service Worker 限制请求并发数
前端
张可爱15 小时前
20251017-Vue2八股文整理(上篇)
前端
FanetheDivine15 小时前
ts中如何描述一个复杂函数的类型
前端·typescript
lightgis15 小时前
chrome中的axure插件提示无法不受支持
前端·chrome
速易达网络15 小时前
Vue3 原生移动应用开发来了
前端·javascript·css
GISer_Jing15 小时前
LLM对话框项目技术栈&重难点总结
前端·ai·node.js
我爱学习_zwj16 小时前
【鸿蒙进阶-7】鸿蒙与web混合开发
前端·华为·harmonyos
小谭鸡米花16 小时前
高德地图电子围栏/地图选区/地图打点
前端·javascript·vue.js
摆烂工程师16 小时前
什么是 ChatGPT Business 会员?与 ChatGPT Plus 有什么不同?
前端·后端·程序员