css3 hover border 流动效果

css 复制代码
/* Hover 边线流动 */

.hoverDrawLine {
  border: 0 !important;
  position: relative;
  border-radius: 5px;
  --border-color: #60daaa;
}
.hoverDrawLine::before,
.hoverDrawLine::after {
  box-sizing: border-box;
  content: '';
  position: absolute;
  border: 2px solid transparent;
  border-radius: 5px;
  width: 0;
  height: 0;
}
.hoverDrawLine::before {
  top: 0;
  left: 0;
  -webkit-transition: height 0.25s ease-out 0.5s, width 0.25s ease-out 0.75s,
    border-color 0s ease-in-out 1s;
  transition: height 0.25s ease-out 0.5s, width 0.25s ease-out 0.75s,
    border-color 0s ease-in-out 1s;
}
.hoverDrawLine::after {
  bottom: 0;
  right: 0;
  -webkit-transition: height 0.25s ease-out 0s, width 0.25s ease-out 0.25s,
    border-color 0s ease-in-out 0.5s;
  transition: height 0.25s ease-out 0s, width 0.25s ease-out 0.25s,
    border-color 0s ease-in-out 0.5s;
}

.hoverDrawLine:hover::before,
.hoverDrawLine:hover::after {
  width: 100%;
  height: 100%;
}
.hoverDrawLine:hover::before {
  border-top-color: var(--border-color);
  border-right-color: var(--border-color);
  -webkit-transition: width 0.25s ease-out, height 0.25s ease-out 0.25s;
  transition: width 0.25s ease-out, height 0.25s ease-out 0.25s;
}
.hoverDrawLine:hover::after {
  border-bottom-color: var(--border-color);
  border-left-color: var(--border-color);
  -webkit-transition: width 0.25s ease-out 0.5s, height 0.25s ease-out 0.75s;
  transition: width 0.25s ease-out 0.5s, height 0.25s ease-out 0.75s;
}
html 复制代码
<div class="hoverDrawLine"></div>
相关推荐
cyforkk11 分钟前
Hexo 双分支部署指南:从原理到 Netlify 实战
前端
小小愿望14 分钟前
前端读取与导出XLSX文件实战指南(React+Ant Design)
前端
小小愿望25 分钟前
JavaScript生成随机数的全面指南:别再只会用Math.random()了!
前端
用户8471810541930 分钟前
wps加载项ribbon.js 与 ribbon.xml 的交互
前端
Jackson__31 分钟前
RAG究竟是什么?一文搞懂大模型的记忆增强术
前端
雲墨款哥33 分钟前
JS算法练习-Day10-判断单调数列
前端·javascript·算法
前端市界33 分钟前
前端视角: PyQt6+Vue3 跨界开发实战
前端·qt·pyqt
阅文作家助手开发团队_山神35 分钟前
第四章:Flutter自定义Engine本地依赖与打包流程
前端·flutter
JuneXcy38 分钟前
11.web api 2
前端·javascript·html
zYear44 分钟前
Elpis 全栈应用框架-- 总结
前端·javascript