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;
    }
  }
相关推荐
简言8568 分钟前
一文搞清楚浏览器js事件循环和渲染事件
前端
yogalin199315 分钟前
网站开发者如何实现反爬虫
前端
bug_kada17 分钟前
ES6 字符串新增方法你了解多少?
前端·javascript
天天扭码18 分钟前
当大模型成为我的赛博嘴替:魔搭社区驯AI实录
前端·人工智能·python
NaZiMeKiY24 分钟前
HTML5前端第四章节
前端·html·html5
超能996要躺平25 分钟前
vue3 实现页面锚点,左边控制右边内容区域滚动
前端·vue.js
木木黄木木28 分钟前
html5制作2048游戏开发心得与技术分享
前端·html·html5
11在上班31 分钟前
学会rebase,多一个代码更新的选择
前端·程序员
数据链路摸索者44 分钟前
ospf动态路由
前端·网络·网络安全·智能路由器
黄毛火烧雪下1 小时前
使用CRACO自定义 Webpack 配置
前端·webpack·node.js