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;
    }
  }
相关推荐
IPIPD1 分钟前
Proxifier规则为什么没有生效?从连接日志定位规则命中与DNS路径
前端
baiyunfan2 分钟前
微信小程序做 PDA 扫码出入库:库存并发控制与 4 个坑
前端
ZoeLandia2 分钟前
React6:组件通信
前端·react.js·typescript
爱勇宝2 分钟前
AI 都这么强了,咱们程序员以后还能干点啥?
前端·后端·程序员
FPGA小徐8 分钟前
【一生一芯 / PA】AM 核心文件逐行解析(上):从 start.S 到 gpu.c
前端·算法
三十而立洋11 分钟前
知枝 · MindSprout:可以直接将 markdown 转换为思维导图的 vscode 插件
前端·visual studio code
兔子零102415 分钟前
架构师最危险的能力:用正确的技术,做出错误的架构决策
前端·javascript·后端
Bug收容所35 分钟前
Vue+js Day2
前端·javascript·vue.js
掘金酱1 小时前
带着作品来,坐下来聊|掘金 X-lab · Coffee Talk 邀请你来见一面
前端·javascript·后端
CoovallyAIHub2 小时前
用 AI 做 PPT 被辞退,法院判公司赔:员工贴进对话框的数据,到底谁负责?
前端·agent