css实现多彩的按钮效果

代码语言:html

所属分类:表单美化

代码描述:css实现多彩的按钮效果

代码标签: 按钮 效果

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


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Inter:400,500,600,700&amp;display=swap'>
<style>
.colorful-button.dark {
  --delay: .35s;
  --c-color-1: rgba(64, 70, 96, 0.3);
  --c-color-2: #362A89;
  --c-color-3: rgba(92, 134, 255, 0.3);
  --c-color-4: rgba(109, 88, 255, 0.4);
  --c-shadow: rgba(54, 42, 137, 0.4);
  --c-shadow-inset-top: rgba(100, 107, 140, 0.6);
  --c-shadow-inset-bottom: rgba(138, 145, 180, 0.4);
  --c-radial-inner: #404660;
  --c-radial-outer: #0D0F18;
}
.colorful-button.light {
  --delay: .15s;
  --c-color-1: rgba(172, 160, 255, 0.15);
  --c-color-2: rgba(110, 171, 255, 0.15);
  --c-color-3: rgba(255, 255, 255, 0.5);
  --c-color-4: rgba(109, 88, 255, 0.15);
  --c-shadow: rgba(0, 76, 180, 0.1);
  --c-shadow-inset-top: white;
  --c-shadow-inset-bottom: white;
  --c-radial-inner: #ECEFFC;
  --c-radial-outer: #fff;
  --c-color: #404660;
}
.colorful-button.secondary {
  --delay: .35s;
  --c-color-1: rgba(172, 160, 255, 0.15);
  --c-color-2: rgba(110, 171, 255, 0.15);
  --c-color-3: rgba(92, 134, 255, 0.5);
  --c-color-4: rgba(172, 160, 255, 0.15);
  --c-shadow: rgba(109, 88, 255, 0.25);
  --c-shadow-inset-top: rgba(172, 160, 255, 0.2);
  --c-shadow-inset-bottom: rgba(172, 160, 255, 0.5);
  --c-radial-inner: #6D58FF;
  --c-radial-outer: #362A89;
}

.colorful-button {
  --duration: 7s;
  --delay: 0s;
  --easing: linear;
  --c-color-1: rgba(92, 134, 255, 0.7);
  --c-color-2: #275EFE;
  --c-color-3: rgba(54, 42, 137, 0.4);
  --c-color-4: rgba(172, 160, 255, 0.3);
  --c-shadow: rgba(39, 94, 254, 0.5);
  --c-shadow-inset-top: rgba(39, 94, 254, 0.8);
  --c-shadow-inset-bottom: rgba(110, 171, 255, 0.6);
  --c-radial-inner: #362A89;
  --c-radial-outer: #6D58FF;
  --c-color: #fff;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  outline: none;
  position: relative;
  cursor: pointer;
  border: none;
  display: table;
  border-radius: 24px;
  padding: 0;
  margin: 0;
  text-align: center;
  min-width: 140px;
  font-family: 'Inter';
  font-weight: 600;
  font-size: 16px;
  letter-spacing: .02em;
  line-height: 1.5;
  color: var(--c-color);
  background: radial-gradient(circle, var(--c-radial-inner), var(--c-radial-outer) 80%);
  box-shadow: 0 0 20px var(--c-shadow);
  margin: 0 20px;
}
.colorful-button:before {
  content: '';
  pointer-events: none;
  position: absolute;
  z-index: 3;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  border-radius: 24px;
  box-shadow: inset 0 4px 12px var(--c-shadow-inset-top), inset 0 -4px 6px var(--c-shadow-inset-bottom);
}
.colorful-button .wrapper {
  -webkit-mask-image: -webkit-radial-gradient(white, black);
  overflow: hidden;
  border-radius: 24px;
  min-width: 132px;
  padding: 12px 0;
}
.colorful-button .wrapper span {
  display: inline-block;
  position: relative;
  z-index: 1;
}
.colorful-button .wrapper .circle {
  position: absolute;
  left: 0;
  top: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  -webkit-filter: blur(var(--blur, 8px));
          filter: blur(var(--blur, 8px));
  background: var(--background, transparent);
  -webkit-transform: translate(var(--x, 0), var(--y, 0)) translateZ(0);
          transform: translate(var(--x, 0), var(--y, 0)) translateZ(0);
  -webkit-animation: var(--animation, none) var(--duration) var(--easing) infinite var(--delay);
          animation: var(--animation, none) var(--duration) var(--easing) infinite var(--delay);
}
.colorful-button .wrapper .circle.circle-1, .colorful-button .wrapper .circle.circle-9, .colorful-button .wrapper .circle.circle-10 {
  --background: var(--c-color-4);
}
.colorful-button .wrapper .circle.circle-3, .colorful-button .wrapper .circle.circle-4 {
  --background: var(--c-color-2);
  --blur: 14px;
}
.colorful-button .wrapper .circle.circle-5, .colorful-button .wrapper .circle.circle-6 {
  --background: var(--c-color-3);
  --blur: 16px;
}
.colorful-button .wrapper .circle.circle-2, .colorful-button .wrapper .circle.circle-7, .colorful-button .wrapper .circle.circle-8, .colorful-button .wrapper .circle.circle-11, .colorful-button .wrapper .circle.circle-12 {
  --background: var(--c-color-1);
  --blur: 12px;
}
.colorful-button .wrapper .circle.circle-1 {
  --x: 0;
  --y: -40px;
  --animation: circle-1;
}
.colorful-button .wrapper .circle.circle-2 {
  --x: 92px;
  --y: 8px;
  --animation: circle-2;
}
.colorful-button .wrapper .circle.circle-3 {
  --x: -12px;
  --y: -12px;
  --animation: circle-3;
}
.colorful-button .wrapper .circle.circle-4 {
  --x: 80px;
  --y: -12px;
  --animation: circle-4;
}
.colorful-button .wrapper .circle.circle-5 {
  --x: 12px;
  --y: -4px;
  --animation: circle-5;
}
.colorful-button .wrapper .circle.circle-6 {
  --x: 56px;
  --y: 16px;
  --animation: circle-6;
}
.colorful-button .wrapper .circle.circle-7 {
  --x: 8px;
  --y: 28px;
  --animation: circle-7;
}
.colorful-button .wrapper .circle.circle-8 {
  --x: 28px;
  --y: -4px;
  --animation: circle-8;
}
.colorful-button .wrapper .circle.circle-9 {
  --x: 20px;
  --y: -12px;
  --animation: circle-9;
}
.colorful-button .wrapper .circle.circle-10 {
  --x: 64px;
  --y: 16px;
  --animation: circle-10;
}
.colorful-button .wrapper .circle.circle-11 {
  --x: 4px;
  --y: 4px;
  --animation: circle-11;
}
.colorful-button .wrapper .circle.circle-12 {
  --blur: 14px;
  --x: 52px;
  --y: 4px;
  --animation: circle-12;
}

@-webkit-keyframes circle-1 {
  33% {
    -webkit-transform: translate(0px, 16px) translateZ(0);
            transform: translate(0px, 16px) translateZ(0);
  }
  66% {
    -webkit-transform: translate(12px, 64px) translateZ(0);
            transform: translate(12px, 64px) translateZ(0);
  }
}

@keyframes circle-1 {
  33% {
    -webkit-transform: translate(0px, 16px) translateZ(0);
            transform: translate(0px, 16px) translateZ(0);
  }
  66% {
    -webkit-transform: translate(12px, 64px) translateZ(0);
            transform: translate(12px, 64px) translateZ(0);
  }
}
@-webkit-keyframes circle-2 {
  33% {
    -webkit-transform: translate(80px, -10px) translateZ(0);
            transform: translate(80px, -10px) translateZ(0);
  }
  66% {
    -webkit-transform: translate(72px, -48px) translateZ(0);
            transform: translate(72px, -48px) translateZ(0);
  }
}
@keyframes circle-2 {
  33% {
    -webkit-transform: translate(80px, -10px) translateZ(0);
            transform: translate(80px, -10px) translateZ(0);
  }
  66% {
    -webkit-transform: translate(72px, -48px) translateZ(0);
            transform: translate(72px, -48px) translateZ(0);
  }
}
@-webkit-keyframes circle-3 {
  33% {
    -webkit-transform: translate(20px, 12px) translateZ(0);
            transform: translate(20px, 12px) translateZ(0);
  }
  66% {
    -webkit-transform: translate(12px, 4px) translateZ(0);
            transform: translate(12px, 4px) translateZ(0);
  }
}
@keyframes circle-3 {
  33% {
    -webkit-transform: translate(20px, 12px) translateZ(0);
            transform: translate(20px, 12px) translateZ(0);
  }
  66% {
    -webkit-transform: translate(12px, 4px) translateZ(0);
            transform: translate(12px, 4px) translateZ(0);
  }
}
@-webkit-keyframes circle-4 {
  33% {
    -webkit-transform: translate(76px, -12px) translateZ(0);
            transform: translate(76px, -12px) translateZ(0);
  }
  66% {
    -webkit-transform: translate(112px, -8px) translateZ(0);
            transform: translate(112px, -8px) translateZ(0);
  }
}
@keyframes circle-4 {
  33% {
    -webkit-transform: translate(76px, -12px) translateZ(0);
            transform: translate(76px, -12px) translateZ(0);
  }
  66% {
    -webkit-transform: translate(112px, -8px) translateZ(0);
            transform: translate(112px, -8px) translateZ(0);
  }
}
@-webkit-keyframes circle-5 {
  33% {
    -webkit-transform: translate(84px, 28px) translateZ(0);
            transform: translate(84px, 28px) translateZ(0);
  }
  66% {
    -webkit-transform: translate(40px, -32px) translateZ(0);
            transform: translate(40px, -32px) translateZ(0);
  }
}
@keyframes circle-5 {
  33% {
    -webkit-transform: translate(84px, 28px) translateZ(0);
            transform: translate(84px, 28px) translateZ(0);
  }
  66% {
    -webkit-transform: translate(40px, -32px) translateZ(0);
            transform: translate(40px, -32px) translateZ(0);
  }
}
@-webkit-keyframes circle-6 {
  33% {
    -webkit-transform: translate(28px, -16px.........完整代码请登录后点击上方下载按钮下载查看

网友评论0