cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <a class="button" href="#">
  <span>Hover me</span>
  <span>Click me</span>
  <span>Thank you!</span>
</a>
            
          
!
            
              @import "bourbon";

$color-bg: #f08;
$color-text: #fff;
$color-button: #0ab;
$color-button-dark: darken($color-button, 20);

$width: 200px;
$height: 40px;
$perspective: 500px;
$speed: 0.5s; 

@import url(https://fonts.googleapis.com/css?family=Lobster);

%on {
  color: $color-text;
  background: $color-button;
  box-shadow: 0 20px 40px rgba(darken($color-bg, 20), 0.6);
}

%off {
  color: darken($color-text, 60);
  background: $color-button-dark;
  box-shadow: none;
}

html,
body {
  height: 100%;
  font: bold 18px "Lobster", Arial, sans-serif;

  @include perspective($perspective);
  @include linear-gradient($color-bg, lighten($color-bg, 15));
}

.button {
  position: fixed;
  top: 50%;
  left: 50%;
  margin-top: -$height;
  margin-left: -$width/2;
  width: $width;
  height: $height;
  
  cursor: pointer;
  text-decoration: none;
  text-shadow: 0 1px 1px $color-button-dark;
  
  @include transform-style(preserve-3d);
  @include transition(all $speed ease-in-out);
  
  span {
    display: block;
    border: 1px solid $color-button-dark;
    text-align: center;
    line-height: $height;
    
    @include transition(all $speed ease);
  }

  span:nth-child(1) {
    @extend  %on;
    @include transform-origin(bottom center);
    @include transform(rotateX(0deg));
  }

  span:nth-child(2) {
    @extend  %off;
    @include transform-origin(top center);
    @include transform(rotateX(-90deg));
  }
  
  span:nth-child(3) {
    @extend  %off;
    @include transform-origin(top center);
    @include transform(rotateX(-180deg) translateY($height) translateZ($height));
  }
}

.button:hover {
  @include transform(translateY(-$height));
  
  span:nth-child(1) {
    @extend  %off;
    @include transform(rotateX(90deg));
  }

  span:nth-child(2) {
    @extend  %on;
    @include transform(rotateX(0deg));
  }
  
  span:nth-child(3) {
    @extend  %on;
    @include transform(rotateX(-90deg));  
  }
}

.button:active {
  span:nth-child(2) {
    @extend %off;
    @include transform(rotateX(90deg));
  }
  
  span:nth-child(3) {
    @extend %on; 
    @include transform-origin(bottom center);
    @include transform(rotateX(0deg) translateY(-$height) translateZ($height));
  }
}

            
          
!
            
              /*
 * Customizable pure CSS animated 3D button 
 * with Sass + Bourbon
 *
 * Need standard CSS?
 *
 * Click the Eye icon at the top right
 * corner of the CSS panel in order to 
 * copy/paste the compiled CSS.
 *
 * Jay S.
 * www.jaysalvat.com
 */
            
          
!
999px
Loading ..................

Console