div+css实现科技感十足的动态按钮效果代码

代码语言:html

所属分类:表单美化

代码描述:div+css实现科技感十足的动态按钮效果代码

代码标签: div css 科技感 十足 动态 按钮

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

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

<head>
    <meta charset="UTF-8">
 
<style>
    html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
}

body {
  background: #222;
  font-family: Segoe UI, sans-serif;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  padding-top: 20%;
}

div {
  margin: 25px;
  width: 300px;
  text-align: center;
  padding: 20px 25px;
  box-sizing: border-box;
  color: #eee;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: #1d1d1d;
  position: relative;
  transition: box-shadow 250ms ease;
}
div::before {
  z-index: -1;
  position: absolute;
  content: "";
  top: 0;
  left: -2px;
  right: -2.5px;
  bottom: -2.25px;
  box-shadow: 0 3px 20px -3px #7af;
  background: linear-gradient(transparent, #7af);
  opacity: 0;
  transition: opacity 250ms ease;
  animation: pulse 3s linear infinite alternate;
}
div::after {
  position: absolute;
  content: "";
  height: 2px;
  top: 0;
  left: 0;
  width: 100%;
  -webkit-filter: drop-shadow(0 0 5px #7af);
  filter: drop-shadow(0 0 5px #7af);
  background-image: linear-gradient(90deg, #7af, #7af 25%, transparent 25%, transparent);
  background-size: 50%;
  animation: loading 2s linear infinite;
  opacity: 0;
  transition: opacity 250ms ease;
}
div.error.loading {
  box-shadow: inset 0 -20px 20px -20px #f33;
}
div.error::before {
  box-shadow: 0 3px 20px -3px #f33;
  background: linear-gradient(transparent, #f33);
}
div.error::after {
  -webkit-filter: drop-shadow(0 0 5px #f33);
  filter: drop-shadow(0 0 5px #f33);
  height: 10px;
  background-image: repeating-linear-gradient(-45deg, #f33, #f33 5px, transparent 5px, transparent 10px);
  background-size: 28px 100%;
  animation: loading 20s linear infinite;
}
div.error strong {
  color: #f33;
}
div.success.loading {
  box-shadow: inset 0 -20px 20px -20px #3f7;
}
div.success::before {
  box-shadow: 0 3px 20px -3px #3f7;
  text-align: center;
  background: linear-gradient(transparent, .........完整代码请登录后点击上方下载按钮下载查看

网友评论0