js+css实现立体按钮悬浮缩放效果代码

代码语言:html

所属分类:悬停

代码描述:js+css实现立体按钮悬浮缩放效果代码,采用prismjs高亮格式化显示css代码。

代码标签: js css 立体 按钮 悬浮 缩放

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

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

<head>
  <meta charset="UTF-8">
  
<link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/inter.3.19.3.css">
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Fira+Mono&amp;display=swap'>
  
<style>
@property --scale {
  syntax: "<number>";
  inherits: false;
  initial-value: 1;
}
@property --translate-y {
  syntax: "<length-percentage>";
  inherits: false;
  initial-value: 0px;
}
button {
  property: --translate-y, --scale;
  transform: translateY(var(--translate-y)) scale(var(--scale));
  transition: --scale 0.9s cubic-bezier(0.75, -0.5, 0, 1.75), --translate-y 0.3s ease;
}
button:hover {
  --translate-y: -8%;
  --scale: 1.2;
}

.fancy-button {
  --fancy-button-gradient-0: #8D49FD;
  --fancy-button-gradient-50: #7F56F3;
  --fancy-button-gradient-100: #5691F3;
  --fancy-button-inner-shadow-top: rgba(233, 209, 255, 0.2);
  --fancy-button-inner-shadow-top-lg: rgba(9, 12, 60, 0.1);
  --fancy-button-inner-shadow-bottom: rgba(137, 222, 246, 0.3);
  --fancy-button-shine-top: #E9D1FF;
  --fancy-button-shine-bottom: #ADFFF9;
  font-family: "Inter";
  font-weight: 500;
  font-size: 16px;
  line-height: 24px;
  text-shadow: 0px 0.5px 0.5px rgba(0, 0, 0, 0.15);
  padding: 0;
  margin: 0;
  -webkit-appearance: none;
     -moz-appearance: none;
          appearance: none;
  border: none;
  outline: none;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  z-index: 1;
  border-radius: 30px;
  color: #fff;
  background-image: linear-gradient(to bottom, var(--fancy-button-gradient-0) 0%, var(--fancy-button-gradient-50) 50%, var(--fancy-button-gradient-100) 100%);
  box-shadow: 0px 4px 12px rgba(9, 12, 60, 0.15), 0px 2px 8px rgba(9, 12, 60, 0.15), 0px 1px 3px var(--fancy-button-inner-shadow-top-lg), inset 0px 1px 1px var(--fancy-button-inner-shadow-top), inset 0px -1px 3px var(--fancy-button-inner-shadow-bottom);
}
.fancy-button:before, .fancy-button:after {
  content: "";
  position: absolute;
  border-radius: inherit;
  will-change: transform;
}
.fancy-button:before {
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--fancy-button-shine-top);
  width: 96px;
  height: 6px;
  top: -3px;
  opacity: 0.6;
  filter: blur(6px);
  transition: opacity 0.25s;
}
.fancy-button:after {
  inset: 0;

  background-size: cover;
  z-index: 2;
  opacity: 0.3;
  mix-blend-mode: overlay;
  pointer-events: none;
}
.fancy-button span {
  display: block;
  padding: 12px 32px;
  border-radius: inherit;
  overflow: hidden;
  positio.........完整代码请登录后点击上方下载按钮下载查看

网友评论0