css实现三维复古按钮效果代码

代码语言:html

所属分类:表单美化

代码描述:css实现三维复古按钮效果代码

代码标签: 复古 按钮 效果

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

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

<head>
 
<meta charset="UTF-8">
<style>
    @charset "UTF-8";
*, :after, :before {
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

body {
  color: #aaa;
  background-color: #2F2F2F;
  text-align: center;
  overflow-x: hidden;
}

#title {
  position: relative;
  margin: 70px auto 50px;
  font-size: 60px;
  font-family: 'Press Start 2P', cursive;
}

.wrapper {
  position: relative;
  display: inline-block;
  margin: 35px auto;
}

.header-wrap {
  display: block;
  width: auto;
  height: auto;
  padding: 0;
  text-align: center;
  font-size: 25px;
  font-family: 'Press Start 2P', cursive;
  transform: perspective(200px) rotateX(10deg);
  letter-spacing: .1em;
  user-select: none;
  text-shadow: 0 -1px 0 #fff, 0 1px 0 #004d40, 0 2px 0 #00483B, 0 3px 0 #004639, 0 4px 0 #004336, 0 5px 0 #004134, 0 6px 0 #003F32, 0 7px 0 #003D30, 0 8px 0 #003A2D, 0 9px 0 #00382B, 0 10px 0 #003528, 0 11px 0 #003225, 0 12px 0 #002F22, 0 13px 0 #002B1E, 0 14px 0 #00281C, 0 15px 0 #001F13, 0 22px 30px rgba(0, 0, 0, 0.9), 0 22px 30px rgba(0, 0, 0, 0.9), 0 22px 15px rgba(0, 0, 0, 0.9), 0 11px 15px rgba(0, 0, 0, 0.9), 0 15px 20px rgba(0, 0, 0, 0.9), 0 15px 11px rgba(0, 0, 0, 0.9), 0 16px 11px rgba(0, 0, 0, 0.9);
  transition: text-shadow .3s ease .3s,  transform .3s ease .3s, letter-spacing .3s ease .3s;
}
.header-wrap:hover {
  transition: text-shadow .33s ease,  transform .3s ease, letter-spacing .3s ease;
  text-shadow: 0 0 0 #004134, 0 1px 0 #00483B, 0 2px 0 #003528, 0 3px 3px rgba(0, 0, 0, 0.9);
  transform: translate(0px, 15px) perspective(200px) rotateX(10deg);
  letter-spacing: .125em;
}

.retro-btn {
  text-transform: uppercase;
  background: 0 0;
}
.retro-btn.lg .btn {
  width: 294px;
  height: 54px;
  font-size: 17px;
  line-height: 50px;
}
.retro-btn.lg .btn .btn-inner .content-wrapper .btn-content .btn-content-inner:before {
  padding-top: 0;
  letter-spacing: .15em;
}
.retro-btn.sm .btn {
  width: 165px;
  height: 37px;
  font-size: 10.5px;
  line-height: 32.5px;
}
.retro-btn.sm .btn .btn-inner .content-wrapper .btn-content .btn-content-inner:before {
  padding-top: 0;
}
.retro-btn.primary .btn .btn-inner .content-wrapper:before {
  background-color: #051D41;
}
.retro-btn.primary .btn .btn-inner .content-wrapper .btn-content {
  background-color: #0d47a1;
}
.retro-btn.secondary .btn .btn-inner .content-wrapper:before {
  background-color: #263238;
}
.retro-btn.secondary .btn .btn-inner .content-wrapper .btn-content {
  background-color: #37474F;
}
.retro-btn.danger .btn .btn-inner .content-wrapper:before {
  background-color: #590000;
}
.retro-btn.danger .btn .btn-inner .content-wrapper .btn-content {
  background-color: #CC0000;
}
.retro-btn.warning .btn .btn-inner .content-wrapper:before {
  background-color: #6A3800;
}
.retro-btn.warning .btn .btn-inner .content-wrapper .btn-content {
  background-color: #FF8800;
}
.retro-btn.success .btn .btn-inner .content-wrapper:before {
  background-color: #00481F;
}
.retro-btn.success .btn .btn-inner .content-wrapper .btn-content {
  background-color: #009A3E;
}
.retro-btn.info .btn .btn-inner .content-wrapper:before {
  background-color: #164E62;
}
.retro-btn.info .btn .btn-inner .content-wrapper .btn-content {
  background-color: #33b5e5;
}
.retro-btn .btn {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  display: inline-block;
  vertical-align: middle;
  padding-top: 3px;
  position: relative;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
  font-style: normal;
  letter-spacing: 0;
  text-rendering: auto;
  text-decoration: none;
  text-align: center;
  -webkit-transition: opacity .1s ease-out;
  transition: opacity .1s ease-out;
  z-index: 5;
  -webkit-font-smoothing: antialiased;
  width: 240px;
  height: 46px;
  font-size: 12px;
  line-height: 24px;
  background-color: transparent;
  text-decoration-color: initial;
  border-color: initial;
  -webkit-tap-highlight-color: transparent;
}
.retro-btn .btn, .retro-btn .btn:focus {
  outline-color: 0;
  outline-style: none;
  outline-width: 0;
}
.retro-btn .btn:hover .btn-content-inner:before {
  background-color: rgba(13, 13, 13, 0.1);
}
.retro-btn .btn:before {
  content: " ";
  background-color: rgba(13, 13, 13, 0.3);
  width: calc(100% - 2px);
  height: calc(100% - 4px);
  bottom: -1px;
  left: 1px;
  position: absolute;
  border-radius: 3px;
  z-index: 1;
  -webkit-transition: background .12s ease-out, -webkit-transform .12s ease-out;
  transition: background .12s ease-out, -webkit-transform .12s ease-out;
  transition: transform .12s ease-out, background .12s ease-out;
  transition: transform .12s ease-out, background .12s ease-out, -webkit-transform .12s ease-out;
}
.retro-btn .btn.btn-left:before {
  -webkit-transform: skewY(1deg) translate3d(0, -0.5px, 0);
  transform: skewY(1deg) translate3d(0, -0.5px, 0);
}
.retro-btn .btn.btn-left .btn-content {
  -webkit-transform: skewY(-1deg);
  transform: skewY(-1deg);
}
.retro-btn .btn.btn-right:before {
  -webkit-transform: skewY(-1deg) translate3d(0, -0.5px, 0);
  transform: skewY(-1deg) translate3d(0, -0.5px, 0);
}
.retro-btn .btn.btn-right .btn-content {
  -webkit-transform: skewY(1deg);
  transform: skewY(1deg);
}
.retro-btn .btn.btn-center:before {
  -webkit-transform: translate3d(0, -1px, 0);
  transform: translate3d(0, -1px, 0);
}
.retro-btn .btn.btn-center .btn-content {
  -webkit-transform: translate3d(0, 1px, 0);
  transform: translate3d(0, 1px, 0);
}
.retro-btn .btn.btn-active .btn-inner .content-wrapper .btn-content {
  -webkit-transition: background .12s ease-out,color .12s ease-out,-webkit-transform .12s ease-out;
  transition: background .12s ease-out,color .12s ease-out,-webkit-transform .12s ease-out;
  transition: transform .12s ease-out,background .12s ease-out,color .12s ease-out;
  transition: transform .12s ease-out,background .12s ease-out,color .12s ease-out,-webkit-transform .12s ease-out;
  -webkit-transform: translate3d(0, 2px, 0);
  transform: translate3d(0, 2px, 0);
}
.retro-btn .btn.btn-active .btn-inner .content-wrapper .btn-content .btn-content-inner {
  opacity: .1;
}
.retro-btn .btn.btn-active:before {
  -webkit-transform: translate3d(0, -3px, 0);
  transform: translate3d(0, -3px, 0);
}
.retro-btn .btn .btn-inner {
  display: block;
  height: 100%;
}
.retro-btn .btn .btn-inner .content-wrapper {
  position: relative;
  font-family: inherit;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: stretch;
  -ms-flex-align: stretch;
  align-items: stretch;
  width: 100%;
  height: calc(100% - 3px);
  margin-top: -3px;
}
.retro-btn .btn .btn-inner .content-wrapper:after, .retro-btn .btn .btn-inner .content-wrapper:before, .retro-btn .btn .btn-inner .content-wrapper .btn-content:after, .retro-btn .btn .btn-inner .content-wrapper .btn-content:before, .retro-btn .btn .btn-inner .content-wrapper .btn-content .btn-content-inner:before {
  display: block;
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
}
.retro-btn .btn .btn-inner .content-wrapper:before {
  background-image: initial;
  background-color: #004d40;
  content: " ";
  border-radius: 3px;
  top: auto;
  bottom: -3px;
  z-index: 1;
  -webkit-transition: background .185s ease-out, -webkit-transform .185s ease-out;
  transition: background .185s ease-out, -webkit-transform .185s ease-out;
  transition: transform .185s ease-out, background .185s ease-out;
  transition: transform .185s ease-out, background .185s ease-out, -webkit-transform .185s ease-out;
}
.retro-btn .btn .btn-inner .content-wrapper:after {
  background-color: rgba(13, 13, 13, 0.15);
  content: " ";
  border-radius: 3px;
  z-index: 3;
  width: 0;
  top: 2px;
}
.retro-btn .btn .btn-inner .content-wrapper .btn-content {
  background-image: initial;
  background-color: #26a69a;
  color: #ebf1f8;
  position: relative;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-flex: 1;
  -ms-flex: 1;
  flex: 1;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  border-radius: 3px;
  text-indent: 0;
  z-index: 3;
  overflow: hidden;
  padding: 0 16px;
  -webkit-transition: border .185s ease-out,background .185s ease-out,color .185s ease-out,-webkit-transform .185s ease-out;
  transition: border .185s ease-out,background .185s ease-out,color .185s ease-out,-webkit-transform .185s ease-out;
  transition: border .185s ease-out,transform .185s ease-out,background .185s ease-out,color .185s ease-out;
  transition: border .185s ease-out,transform .185s ease-out,background .185s ease-out,color .185s ease-out,-web.........完整代码请登录后点击上方下载按钮下载查看

网友评论0