CSS梯形进度条

CSS梯形进度条

通过一个梯形的背景图做背景,在上面画一个梯形的div,实现进度条的样式。

代码如下

<div class="step_main">
  <!-- 进度条 -->
  <div class="step_box">
    <div class="wrap" :style="{width: now_factory_item.rate + '%'}">
      <div class="clip-path" ref="clipPath"></div>
      <span></span>
      <span class="guang"></span>
    </div>
    <img :src="require('@/assets/img/111111.png')">
  </div>
</div>
.step_main {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: 0.6rem;
  .step_box {
    position: relative;
    height: .97rem;
    width: 3.12rem;
    >img {
      width: 100%;
      height: .39rem;
      object-fit: cover;
    }
    .wrap_other {
      .clip-path {
        clip-path: polygon(100% 0, 97% 100%, 0 100%, .1rem 0) !important;
      }
      span {
        &:nth-child(2) {
          width: 98%;
        }
      }
    }
    .wrap {
      width: 0;
      position: absolute;
      z-index: 9;
      bottom: 0;
      height: .39rem;
      transition: width .5s linear;
      .clip-path {
        width: 100%;
        height: .23rem;
        background-image: linear-gradient(to right, #2e93d8, #9ae3de);
        clip-path: polygon(97% 0, 100% 100%, 0 100%, .1rem 0);
        position: relative;
        border-top-left-radius: .02rem;
        border-top-right-radius: .02rem;
      }
      span {
        &:nth-child(2) {
          position: absolute;
          width: 100%;
          height: .16rem;
          border-bottom-left-radius: .02rem;
          border-bottom-right-radius: .02rem;
          background: linear-gradient(to right, #2e93d8, #9ae3de);
          top: .22rem;
        }
        &.guang {
          width: 100%;
          height: .97rem;
          background: linear-gradient(180deg, rgba(47,184,255,0) 0%, rgba(47,184,255,0) 20%, rgba(75,198,245,0.4) 55%, rgba(107,212,235,0.7) 84%, #85E0E1 100%);
          position: absolute;
          left: 0;
          bottom: 0;
          border-bottom-left-radius: .02rem;
          border-bottom-right-radius: .02rem;
        }
      }
    }
    >img {
      position: absolute;
      bottom: 0;
    }
  }
}

*感谢玉姐,转载请注明出处

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值