svg+css实现动态背景按钮效果代码

代码语言:html

所属分类:布局界面

代码描述:svg+css实现动态背景按钮效果代码

代码标签: svg css 动态 背景 按钮

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开


<!DOCTYPE html>
<html lang="en" >

<head>

  <meta charset="UTF-8">

  
  
<style>
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap");
body {
  background: #170F1E;
  display: grid;
  height: 100vh;
  place-items: center;
  -webkit-font-smoothing: antialiased;
  width: 100vw;
}

button {
  animation: 1.5s ease infinite alternate running shimmer;
  background: linear-gradient(90deg, #FFE27D 0%, #64E3FF 30%, #9192FF 85%);
  background-size: 200% 100%;
  border: none;
  border-radius: 6px;
  box-shadow: -2px -2px 10px rgba(255, 227, 126, 0.5), 2px 2px 10px rgba(144, 148, 255, 0.5);
  color: #170F1E;
  cursor: pointer;
  font-family: "Inter", sans-serif;
  font-size: 16px;
  font-weight: 670;
  line-height: 24px;
  overflow: hidden;
  padding: 12px 24px;
  position: relative;
  text-decoration: none;
  transition: 0.2s;
}
button svg {
  left: -20px;
  opacity: 0.5;
  position: absolute;
  top: -2px;
  transition: 0.5s cubic-bezier(0.5, -0.5, 0.5, 1.5);
}
button:hover svg {
  opacity: 0.8;
  transform: translateX(50px) scale(1.5);
}
button:active {
  transform: scale(0.95) rotate(-3deg);
}

@keyframes shimmer {
  to {
    background-size: 100% 100%;
    box-shadow: -2px -2px 6px rgba(255, 227, 126, 0.5), 2px 2px 6px rgba(144, 148, 255, 0.5);
  }
}
</style>



</head>

<body >
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0