Skip to content

CSS下的Button(八)

示例

代码

html
<button class="my-btn8">
  <span>New to you</span>
</button>
css
.my-btn8 {
  position: relative;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(45deg, #0ce39a, #69007f, #fc0987);
  padding: 14px 25px;
  border-radius: 10px;
  font-size: 1.25em;
  cursor: pointer;
}

.my-btn8 span {
  position: relative;
  z-index: 1;
}

.my-btn8::before {
  content: "";
  position: absolute;
  inset: 1px;
  background: #272727;
  border-radius: 9px;
  transition: 0.5s;
}

.my-btn8:hover::before {
  opacity: 0.7;
}

.my-btn8::after {
  content: "";
  position: absolute;
  inset: 0px;
  background: linear-gradient(45deg, #0ce39a, #69007f, #fc0987);
  border-radius: 9px;
  transition: 0.5s;
  opacity: 0;
  filter: blur(20px);
}

.my-btn8:hover:after {
  opacity: 1;
}