3D button

background removes 3D style

by Jernej Slejko

HTML

<section class="bg-orange">
  <div class="col-md-8 offset-md-2 pt1 text-center">
    <a href="#" class="btn-3d">Find out more</a>
  </div>
</section>

<section>
  <div class="col-md-8 offset-md-2 pt1 text-center">
    <a href="#" class="btn-3d">Find out more</a>
  </div>
</section>

CSS

:root {
  --menu-height: 95px;
  --menu-height-mobile: 64px;
  --burger-menu-width: 24px;

  --brown: #4A0D00;
  --orange: #E74011;
  --light-orange: #FCE2D9;
  --mustard: #FFB000;
  --light-mustard: #FFEFCC;
  --serenade: #FFF5E6;
  --light-grey: #F5F5F5;
  --white: #FFFFFF;
  --black: #000000;
  --off-black: #333333;
}
section {
  height: 25vh;
  padding: 25px;
}

.bg-orange {
  background: var(--orange);
}

.btn-3d {
  top: 0;
  left: 0;
  transition: all 0.15s linear 0s;
  position: relative;
  display: inline-block;
  /* transform-origin: right bottom; */

  padding: 15px 25px;
  background-color: var(--mustard);

  border-radius: 0;

  font-family: 'Effra', Helvetica, Arial, sans-serif;
  font-weight: bold;
  font-style: normal;
  font-size: 14px;
  text-transform: uppercase;
  color: var(--brown);
  letter-spacing: 2px;

  box-shadow: 6px 6px 0 var(--brown);
  text-decoration: none;
  z-index: 1;
}

.btn-3d::before,
.btn-3d::after {
  transition: all 0.15s linear 0s;
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  background-color: var(--brown);
  z-index: -1;
}
.btn-3d::after {
  transform: skewY(45deg);
  top: 3px;
  right: -6px;
}
.btn-3d::before {
  transform: skewX(45deg);
  bottom: -6px;
  left: 3px;
}

.btn-3d:hover {
  top: 3px;
  left: 3px;
  box-shadow: 3px 3px 0 var(--brown);
}
.btn-3d:hover::after {
  top: 1px;
  right: -3px;
  width: 3px;
}
.btn-3d:hover::before {
  bottom: -3px;
  left: 1px;
  height: 3px;
}

a:active.btn-3d {
  top: 6px;
  left: 6px;
  box-shadow: none;
}
a:active.btn-3d::before {
  bottom: 0;
  left: 0;
  height: 0;
}
a:active.btn-3d::after {
  top: 0;
  right: 0;
  width: 0;
}