css矩形盒子实现虚线流动边框+css实现step连接箭头

由于项目里需要手写步骤条 且实现指定状态边框虚线流动效果,故使用css去绘制步骤条连接箭头和绘制边框流动效果

效果:

1.绘制步骤条连接箭头

html 复制代码
    <ul class="process-list">
      <div v-for="(process, index) in processes" :key="index" class="flex items-center item-box">
        <li :class="active==process.id?'active':''">
          <span class="process-name">{{ process.name }}</span>
        </li>
        <div class="arrow"></div>
      </div>
    </ul>
css 复制代码
// 绘制连接线
.arrow {
  display:inline-block;
  height:2px;
  width:80px;
  background-color:#909399;
  position:relative;
  margin-left: 10px;
  margin-right: 20px;
}
// 绘制箭头
.arrow:before {
  position:absolute;
  content:"";
  width:0;
  height:0;
  border:6px solid transparent;
  border-left:6px solid #909399;
  left:100%;
  top:50%;
  transform: translateY(-50%);
}

2.绘制流动虚线边框

css 复制代码
  .process-item.active {
    color: #000;
    background-color: rgba(144, 147, 153, 0.2);
    position: relative;
    z-index: 2;
    background: linear-gradient(90deg, #2671e2 50%, transparent 0) repeat-x,
      linear-gradient(90deg, #2671e2 50%, transparent 0) repeat-x,
      linear-gradient(0deg, #2671e2 50%, transparent 0) repeat-y,
      linear-gradient(0deg, #2671e2 50%, transparent 0) repeat-y;
    background-color: rgba(144, 147, 153, 0.2);
    background-size: 8px 2px, 8px 2px, 2px 8px, 2px 8px;
    background-position: 0 0, 0 100%, 0 0, 100% 0;
    animation: linearGradientMove 0.3s infinite linear;
  }
  // 虚线动画
  @keyframes linearGradientMove {
    100% {
      background-position: 8px 0, -8px 100%, 0 -8px, 100% 8px;
    }
  }
相关推荐
D_jing2026 分钟前
Vue 3 + Element Plus 重置el-drawer样式失效
前端·javascript·vue.js
__log28 分钟前
Vue 3 与 React 18+ 核心技术深度对比:从源码到实战
前端·vue.js·react.js
很晚很晚了5 小时前
纯前端转全栈 Day 1:我从第一个 NestJS 接口开始
前端
Lee川6 小时前
从零解剖一个 AI Agent Tool是如何实现的
前端·人工智能·后端
wangruofeng7 小时前
Playwright 深度调研:为什么它成了浏览器自动化的新底座
前端·测试
李白的天不白9 小时前
SSR服务端渲染
前端
卷帘依旧10 小时前
SSE(Server-Sent Events)完全指南
前端
码云之上10 小时前
万星入坞:我们如何用三层插件体系干掉巨石应用
前端·架构·前端框架
kyriewen10 小时前
一口气讲清楚 Monorepo、Turborepo、pnpm、Changesets 到底是什么?
前端·架构·前端工程化
IT_陈寒11 小时前
React性能优化踩的坑,这个错你可能也会犯
前端·人工智能·后端