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>
相关推荐
谢尔登26 分钟前
【React】React 18 并发特性
前端·react.js·前端框架
Joker`s smile29 分钟前
使用React+ant Table 实现 表格无限循环滚动播放
前端·javascript·react.js
国家不保护废物34 分钟前
🌟 React 魔法学院入学指南:从零构建你的第一个魔法阵(项目)!
前端·react.js·架构
import_random36 分钟前
[机器学习]svm支持向量机(优势在哪里)
前端
国家不保护废物38 分钟前
从刀耕火种到现代框架:DOM编程 vs Vue/React 进化史
前端·vue.js·react.js
陈随易38 分钟前
Univer v0.8.0 发布,开源免费版 Google Sheets
前端·后端·程序员
不怎么爱学习的dan43 分钟前
实现 ECharts 多国地区可视化方案
前端
嘉小华44 分钟前
Android Lifecycle 状态同步与分发机制深度解析
前端
李三岁_foucsli1 小时前
chrome架构-多进程和进程中的线程
前端·google
阿琳a_1 小时前
前端对WebSocket进行封装,并建立心跳监测
前端·javascript·vue.js·websocket