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>
相关推荐
筱歌儿几秒前
css 左右布局
前端·css
GISer_Jing25 分钟前
编译原理AST&以Babel为例进行解读、Webpack中自定义loader与plugin
前端·webpack·node.js
GISer_Jing26 分钟前
Webpack中Compiler详解以及自定义loader和plugin详解
前端·webpack·node.js
浩~~37 分钟前
CSS常用选择器
前端·css
于慨43 分钟前
uniapp+vite+cli模板引入tailwindcss
前端·uni-app
yunvwugua__1 小时前
Python训练营打卡 Day26
前端·javascript·python
满怀10151 小时前
【Django全栈开发实战】从零构建企业级Web应用
前端·python·django·orm·web开发·前后端分离
Darling02zjh2 小时前
GUI图形化演示
前端
Channing Lewis2 小时前
如何判断一个网站后端是用什么语言写的
前端·数据库·python
互联网搬砖老肖2 小时前
Web 架构之状态码全解
前端·架构