css实现按钮悬浮边框动画效果代码
代码语言:html
所属分类:悬停
代码描述:css实现按钮悬浮边框动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> * { margin: 0; padding: 0; box-sizing: border-box; } body { display: flex; flex-direction: column; gap: 1rem; align-items: center; justify-content: center; min-height: 100vh; background: #27272c; } button { position: relative; background: #444; color: #fff; text-decoration: none; text-transform: uppercase; border: none; letter-spacing: 0.1rem; font-size: 1rem; padding: 1rem 3rem; transition: 0.2s; } button:hover { letter-spacing: 0.2rem; padding: 1.1rem 3.1rem; background: var(--clr); color: var(--clr); /* box-shadow: 0 0 35px var(--clr); */ animation: box 3s infinite; } button::before { content: ""; position: absolute; inset: 2px; background: #272822; } button span { position: relative; z-index: 1; } button i { position: absolute; inset: 0; display: block; } button i::before { content: ""; position: absolute; width: 10px; height: 2px; left: 80%; top: -2px; border: 2px solid var(--clr); background: #272822; transition: 0.2s; } button:hover i::before { width: 15px; left: 20%; animation: move 3s infinite; } button i::after { content: ""; position: absolute; width: 10px; height: 2px; left: 20%; bottom: -2px; border: 2px solid var(--clr); background: #272822;.........完整代码请登录后点击上方下载按钮下载查看
网友评论0