Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="center">

  <h1>Cool Button</h1>

  <a href="#" class="button">
    <div class="bottom"></div>
    <div class="top">
      <div class="label">Click Me (#1)</div>
      <div class="button-border button-border-left"></div>
      <div class="button-border button-border-top"></div>
      <div class="button-border button-border-right"></div>
      <div class="button-border button-border-bottom"></div>
    </div>
  </a>

  <a href="#" class="button2">Click Me (#2)</a>
  <a href="#" class="button3">Click Me (#3)</a>

  <p>Above you can see button#1 with all effects visible, like the changing of color (transition) of the 4 seperate borders. Button#2 is the simple version, coded with :before pseudo-element, big difference is that I'm using outline here instead of the border-property used in button#1. Button#3 is even WCAG2.0 compliant because the background is no longer a :before pseude-element and therefor you now have color-contrast (in this example the color-contrast is too low).
  
  <p>Button#2 and button#3 are way easier to embed in a CMS with dynamical input and easier to maintain. I had to code button#2 and button#3 with an outline to maintain the visual effect of overlapping. If you use the border property in the button#2 and button#3 the (orange) background would overlap the border.

  <div class="background">

    <a href="#" class="button">
      <div class="bottom"></div>
      <div class="top">
        <div class="label">Click Me (#1)</div>
        <div class="button-border button-border-left"></div>
        <div class="button-border button-border-top"></div>
        <div class="button-border button-border-right"></div>
        <div class="button-border button-border-bottom"></div>
      </div>
    </a>

    <a href="#" class="button2">Click Me (#2)</a>
    <a href="#" class="button3">Click Me (#3)</a>

  </div>

</div>
              
            
!

CSS

              
                *,
*:before,
*:after {
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}
.center {
  text-align: center;
}

p { line-height: 140%; }
.background {
  background: rgba(0,0,0,.4);
}
.button {
  display: inline-block;
  text-decoration: none;
  position: relative;
  margin: 40px 12px;
  z-index: 0;
  transition: background .3s ease;
}
.button .bottom {
  position: absolute;
  left: 7px;
  top: 7px;
  width: 100%;
  height: 100%;
  background-color: #ed9121;
  display: block;
  -webkit-transition: all 0.15s ease-out;
  -moz-transition: all 0.15s ease-out;
  -o-transition: all 0.15s ease-out;
  transition: all 0.15s ease-out;
}
.button .top .label {
  font-family: sans-serif;
  font-weight: 400;
  color: #FFF;
  font-size: 12px;
  line-height: 110%;
  letter-spacing: 2px;
  text-align: center;
  text-transform: uppercase;
  -webkit-transition: all 0.15s ease-out;
  -moz-transition: all 0.15s ease-out;
  -o-transition: all 0.15s ease-out;
  transition: all 0.15s ease-out;
}
.button-border {
  position: absolute;
  background-color: #ceab6a;
  -webkit-transition: all 0.25s ease-out;
  -moz-transition: all 0.25s ease-out;
  -o-transition: all 0.25s ease-out;
  transition: all 0.25s ease-out;
}
.button-border-left {
  left: -2px;
  bottom: -2px;
  width: 2px;
  height: 0;
}
.button-border-top {
  left: -2px;
  top: -2px;
  width: 0;
  height: 2px;
}
.button-border-right {
  right: -2px;
  top: -2px;
  width: 2px;
  height: 0;
}
.button-border-bottom {
  right: -2px;
  bottom: -2px;
  width: 0;
  height: 2px;
}
.button .top {
  position: relative;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  padding: 24px 34px 22px 34px;
  border: 2px solid #0c4a45;
}

.button:hover .bottom {
  left: 0;
  top: 0;
  background-color: #f3f3f3;
}
.button-dark:hover .bottom {
  background-color: #111;
  background-color: rgba(17, 17, 17, 0.8);
}
.button:hover .top .label {
  color: #0c4a45;
}
.button-border {
  position: absolute;
  background-color: #ed9121;
  -webkit-transition: all 0.25s ease-out;
  -moz-transition: all 0.25s ease-out;
  -o-transition: all 0.25s ease-out;
  transition: all 0.25s ease-out;
}
.button:hover .top .button-border-left,
.button:hover .top .button-border-right {
  height: calc(100% + 2px);
}
.button:hover .top .button-border-top,
.button:hover .top .button-border-bottom {
  width: calc(100% + 2px);
}


.button2 {
  display: inline-block;
  text-decoration: none;
  position: relative;
  margin: 40px 12px;
  padding: 24px 34px 22px 34px;
  outline: 3px solid #0c4a45;
  font-family: sans-serif;
  font-weight: 400;
  color: #FFF;
  font-size: 12px;
  line-height: 110%;
  letter-spacing: 2px;
  text-align: center;
  text-transform: uppercase;
  z-index: 1;
}

.button2:before {
  content: "";
  position: absolute;
  left: 7px;
  top: 7px;
  width: calc(100% + 2px);
  height: calc(100% + 2px);
  background-color: #ed9121;
  display: block;
  z-index: -1;
  -webkit-transition: all 0.3s ease-out;
  -moz-transition: all 0.3s ease-out;
  -o-transition: all 0.3s ease-out;
  transition: all 0.3s ease-out;
}

.button2:hover {
  color: #000;
  outline: 3px solid #ed9121;
}
.button2:hover:before {
  top: 0;
  left: 0;
  background: #FFF;
}

.button3 {
  display: inline-block;
  text-decoration: none;
  position: relative;
  margin: 40px 12px;
  padding: 24px 34px 22px 34px;
  background-color: #ed9121;
  font-family: sans-serif;
  font-weight: 400;
  color: #FFF;
  font-size: 12px;
  line-height: 110%;
  letter-spacing: 2px;
  text-align: center;
  text-transform: uppercase;
  z-index: 1;
}

.button3:before {
  content: "";
  position: absolute;
  left: 7px;
  top: 7px;
  width: calc(100% - 4px);
  height: calc(100% - 4px);
  outline: 3px solid #0c4a45;
  display: block;
  z-index: -1;
  -webkit-transition: all 0.3s ease-out;
  -moz-transition: all 0.3s ease-out;
  -o-transition: all 0.3s ease-out;
  transition: all 0.3s ease-out;
}

.button3:hover {
  color: #000;
  
}
.button3:hover:before {
  top: 2px;
  left: 2px;
  background: #FFF;
  outline: 3px solid #ed9121;
}


h1 {
  margin: 24px 5% 32px;
  font-size: 32px;
  font-weight: 700;
  text-align: center;
}
p {
  margin: 0 5% 24px;
}
              
            
!

JS

              
                
              
            
!
999px

Console