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 includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

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="container">

<div class="mainbox">
  
  <h1 class="heading">Modern Button Collection <small>(Version 1.1.0)</small></h1>
  <h2>New: Ripple Effect</h2>
  <a class="btn btn-primary btn-lg btn-ripple" href="#">Primary Button</a>
  <a class="btn btn-warning btn-lg btn-flat btn-ripple" href="#">Warning Button</a>
  <a class="btn btn-danger btn-lg btn-round btn-ripple" href="#">Danger Button</a>
  <a class="btn btn-success btn-lg btn-border-inverse btn-ripple" href="#">Success Button</a>
  <a class="btn btn-info btn-lg btn-3d btn-ripple" href="#">Info Button</a>

  <h2>New: Shikoba Effect</h2>
  <a class="btn btn-primary btn-lg btn-ripple btn-shikoba btn-shikoba--briefcase" href="#">Primary Button</a>
  <a class="btn btn-warning btn-lg btn-flat btn-ripple btn-shikoba btn-shikoba--cog" href="#">Warning Button</a>
  <a class="btn btn-danger btn-lg btn-round btn-ripple btn-shikoba btn-shikoba--bullhorn" href="#">Danger Button</a>
  <a class="btn btn-success btn-lg btn-border-inverse btn-ripple btn-shikoba btn-shikoba--archive" href="#">Success Button</a>
  <a class="btn btn-info btn-lg btn-3d btn-ripple btn-shikoba btn-shikoba--diamond" href="#">Info Button</a>

  <div class="info">Put a <a href="http://fontawesome.io/icons/" target="_blank">Font Awesome class</a> at the end of <i>btn-shiokba--</i>; for example, <i>btn-shikoba--<a href="http://fontawesome.io/icon/diamond/" target="_blank">diamond</a></i>.</div>
  
  <h2>Large</h2>
  <a class="btn btn-primary btn-lg" href="#">Primary Button</a>
  <a class="btn btn-warning btn-lg" href="#">Warning Button</a>
  <a class="btn btn-danger btn-lg" href="#">Danger Button</a>
  <a class="btn btn-success btn-lg" href="#">Success Button</a>
  <a class="btn btn-info btn-lg" href="#">Info Button</a>
  <a class="btn btn-disabled btn-lg" href="#">Disabled Button</a>
  
  <h2>Small</h2>
  <a class="btn btn-primary btn-sm" href="#">Primary Button</a>
  <a class="btn btn-warning btn-sm" href="#">Warning Button</a>
  <a class="btn btn-danger btn-sm" href="#">Danger Button</a>
  <a class="btn btn-success btn-sm" href="#">Success Button</a>
  <a class="btn btn-info btn-sm" href="#">Info Button</a>
  <a class="btn btn-disabled btn-sm" href="#">Disabled Button</a>
  
  <h2>Flat</h2>
  <a class="btn btn-primary btn-lg btn-flat" href="#">Primary Button</a>
  <a class="btn btn-warning btn-lg btn-flat" href="#">Warning Button</a>
  <a class="btn btn-danger btn-lg btn-flat" href="#">Danger Button</a>
  <a class="btn btn-success btn-lg btn-flat" href="#">Success Button</a>
  <a class="btn btn-info btn-lg btn-flat" href="#">Info Button</a>
  <a class="btn btn-disabled btn-lg btn-flat" href="#">Disabled Button</a>
  
  <h2>Round</h2>
  <a class="btn btn-primary btn-lg btn-round" href="#">Primary Button</a>
  <a class="btn btn-warning btn-lg btn-round" href="#">Warning Button</a>
  <a class="btn btn-danger btn-lg btn-round" href="#">Danger Button</a>
  <a class="btn btn-success btn-lg btn-round" href="#">Success Button</a>
  <a class="btn btn-info btn-lg btn-round" href="#">Info Button</a>
  
  <h2>Border</h2>
  <a class="btn btn-primary btn-lg btn-border btn-flat" href="#">Primary Button</a>
  <a class="btn btn-warning btn-lg btn-border btn-flat" href="#">Warning Button</a>
  <a class="btn btn-danger btn-lg btn-border btn-flat" href="#">Danger Button</a>
  <a class="btn btn-success btn-lg btn-border btn-flat" href="#">Success Button</a>
  <a class="btn btn-info btn-lg btn-border btn-flat" href="#">Info Button</a>
  
  <h2>Border Inverse</h2>
  <a class="btn btn-primary btn-lg btn-round btn-border-inverse" href="#">Primary Button</a>
  <a class="btn btn-warning btn-lg btn-round btn-border-inverse" href="#">Warning Button</a>
  <a class="btn btn-danger btn-lg btn-round btn-border-inverse" href="#">Danger Button</a>
  <a class="btn btn-success btn-lg btn-round btn-border-inverse" href="#">Success Button</a>
  <a class="btn btn-info btn-lg btn-round btn-border-inverse" href="#">Info Button</a>
  
  <h2>3D</h2>
  <a class="btn btn-primary btn-lg btn-round btn-border-inverse btn-3d" href="#">Primary Button</a>
  <a class="btn btn-warning btn-lg btn-round btn-border-inverse btn-3d" href="#">Warning Button</a>
  <a class="btn btn-danger btn-lg btn-round btn-border btn-3d" href="#">Danger Button</a>
  <a class="btn btn-success btn-lg btn-round btn-border btn-3d" href="#">Success Button</a>
  <a class="btn btn-info btn-lg btn-round btn-border btn-3d" href="#">Info Button</a>

  <div class="browsers">
    <h2>Supported Browsers:</h2>
    <ul>
      <li class="chrome">Chrome</li>
      <li class="firefox">Firefox</li>
      <li class="safari">Safari</li>
      <li class="opera">Opera</li>
      <li class="ie">IE 9+</li>
    </ul>
  </div><!-- /.browsers -->
  <div class="credit">
    <h2>Credit:</h2>
    <ul>
      <li><a href="https://designmodo.github.io/Flat-UI/" target="_blank">https://designmodo.github.io/Flat-UI/</a></li>
      <li><a href="https://tympanus.net/Development/CreativeButtons/" target="_blank">https://tympanus.net/Development/CreativeButtons/</a></li>
      <li><a href="https://codepen.io/KrisOlszewski/pen/Dnktj" target="_blank">https://codepen.io/KrisOlszewski/pen/Dnktj</a></li>
      <li><a href="https://tympanus.net/codrops/2015/02/26/inspiration-button-styles-effects/" target="_blank">https://tympanus.net/codrops/2015/02/26/inspiration-button-styles-effects/</a></li>
    </ul>
  </div><!-- /.credit -->
  <div class="follow">
    <h2>Follow me:</h2>
    <ul>
      <li>Twitter: <a href="https://twitter.com/ryanyudotme" target="_blank">@iamryanyu</a></li>
    </ul>
  </div><!-- /.follow -->
  <div class="changelog">
    <h2>Changelog:</h2>
    <ul>
      <li>
        <h3>Version 1.1.0 (2015-03-08)</h3>
        <ul>
          <li>NEW: Add a ripple effect</li>
          <li>NEW: Add a shikoba effect</li>
        </ul>
      </li>
      <li>
        <h3>Version 1.0.0 (2015-01-15)</h3>
        <ul>
          <li>Release</li>
        </ul>
      </li>
    </ul>
  </div>
</div><!-- /.mainbox -->
</div><!-- /.container -->
              
            
!

CSS

              
                @import "compass/css3";

@import url(https://fonts.googleapis.com/css?family=Droid+Sans:400,700);

/*-- Variables --*/
$green-aqua: #1abc9c;
$yellow: #f4d313;
$white: unquote(#fff);
$red: #C9302C;
$green: #449d44;
$blue: #31b0d5;
$grey-light: #bdc3c7;

$primary-color: $green-aqua;
$warning-color: $yellow;
$danger-color: $red;
$success-color: $green;
$info-color: $blue;
$disabled-color: $grey-light;

$mq-tablet-small: "screen and (min-width: 37.500em)"; // 600px
$mq-tablet: "screen and (min-width: 48.000em)"; // 768px
$mq-desktop: "screen and (min-width: 64.000em)"; // 1024px

$base-font-pixel: 16;

/*-- Placeholder --*/
%list-reset {
  list-style: none;
  margin: 0;
  padding: 0;
}

%clearfix {
  // credit: http://nicolasgallagher.com/micro-clearfix-hack/
  .cf:before,
  .cf:after {
    content: " "; /* 1 */
    display: table; /* 2 */
    line-height: 0;
  }

  .cf:after {
    clear: both;
  }

  /**
   * For IE 6/7 only
   * Include this rule to trigger hasLayout and contain floats.
   */
  .cf {
    *zoom: 1;
  }
}

/*-- Mixins --*/
@mixin font-size($sizeValue: 1) {
  font-size: ($sizeValue * $base-font-pixel) + px;
  font-size: $sizeValue + rem;
}

// construct button
@mixin build-btn($bgColor, $ftColor) {
  background-color: $bgColor;
  color: $ftColor;
  border-color: $bgColor;
  
  &:hover {
    background-color: saturate(lighten($bgColor, 6), 1);
    border-color: saturate(lighten($bgColor, 6), 1);
  }
  
  &.btn-border {
    &:hover {
      color: $bgColor;
    }
  }
  
  &.btn-border-inverse {
    background-color: $ftColor;
    color: $bgColor;
    border-color: $bgColor;
    
    &:hover {
      background-color: $bgColor;
      color: $ftColor;
    }
  }
  
  &.btn-3d {
    box-shadow: 0px 4px saturate(darken($bgColor, 12), 1);
    position: relative;
    
    &:hover {
      background-color: $bgColor;
      color: $ftColor;
      border-color: $bgColor;
      top: 2px;
      box-shadow: 0px 2px saturate(darken($bgColor, 12), 1);
    }
    
    &.btn-3d.btn-border-inverse {
      &:hover {
        background-color: $ftColor;
        color: $bgColor;
      }
    }
    
    &:active {
      top: 4px;
      box-shadow: 0px 0px saturate(darken($bgColor, 12), 1);
    }
  }
}

/*-- Utilities --*/
.clearfix {
  @extend %clearfix;
}

/*-- General --*/
body {
  font-family: 'Droid Sans', sans-serif;
  background-color: #e1e3f2;
}

.container {
  width: 60%;
  margin: 50px auto;
}

.heading {
  margin-bottom: 50px;
}

.btn {
  margin: 0 20px 20px 0;
}

.intro {
  margin-top: 80px;
}

.info {
  background-color: #ced2ea;
  border: 1px solid #bcc2e5;
  padding: 10px;
}

// browsers
.browsers {
  margin: 50px 0 50px;
  overflow: hidden;

  ul {
    @extend %list-reset;
  }

  li {
    float: left;
    text-align: center;
    padding-top: 80px;
    margin-right: 25px;
    background-size: 400px;
    background-image: url('http://outdatedbrowser.com/public/imgs/browsers-bg.png');
    background-repeat: no-repeat;

    @include font-size(.8125);
  }

  .chrome {
    width: 67px;
    background-position: -6px -83px;
  }

  .firefox {
    width: 69px;
    background-position: -85px -83px;
  }

  .safari {
    width: 69px;
    background-position: -246px -83px;
  }

  .opera {
    width: 66px;
    background-position: -327px -83px;
  }

  .ie {
    width: 70px;
    background-position: -165px -83px;
  }
}

// credit
.credit {
  margin: 0 0 50px;
}

.changelog {
  margin-top: 50px;
}

/*-- Buttons --*/
.btn {
  border-radius: 5px;
  border: 3px solid transparent;
  display: inline-block;
  position: relative;
  text-decoration: none;
  transition: background-color .3s ease 0s, border-color .3s ease 0s, color .3s ease 0s;
}

.btn-primary {
  @include build-btn($primary-color, $white);
}

.btn-warning {
  @include build-btn($warning-color, $white);
}

.btn-danger {
  @include build-btn($danger-color, $white);
}

.btn-success {
  @include build-btn($success-color, $white);
}

.btn-info {
  @include build-btn($info-color, $white);
}

.btn-disabled {
  background-color: $disabled-color;
  color: $white;
  cursor: default;
}

.btn-border {
  &:hover {
    background-color: $white;
  }
}

.btn-lg {
  padding: 10px 12px;
}

.btn-sm {
  padding: 8px 10px;
  
  @include font-size(.875);
}

.btn-round {
  border-radius: 40px;
}

.btn-flat {
  border-radius: 0;
}

/* ripple effect */
.btn-ripple__container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: transparent;
}

.btn-ripple__circle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .25);
  
  .btn-ripple__container.is-active & {
    animation: ripples .4s ease-in;
  }
}

@keyframes ripples {
  0% {
    opacity: 0;
  }

  25% {
    opacity: 1;
  }

  100% {
    width: 200%;
    padding-bottom: 200%;
    opacity: 0;
  }
}

/* shikoba effect */
.btn-shikoba {
  overflow: hidden;
  padding-left: 2em;

  > i {
    position: absolute;
    left: 20px;
    font-size: 18px;
    -webkit-transform: translate3d(-40px, 2.5em, 0);
    transform: translate3d(-40px, 2.5em, 0);
    -webkit-transition: -webkit-transform 0.3s;
    transition: transform 0.3s;
    -webkit-transition-timing-function: cubic-bezier(.75, 0, .125, 1);
    transition-timing-function: cubic-bezier(.75, 0, .125, 1);

    .lt-ie10 & {
      -ms-transform: translate(-40px);
    }
  }

  > span {
    display: inline-block;
    -webkit-transform: translate3d(-10px, 0, 0);
    transform: translate3d(-10px, 0, 0);
    -webkit-transition: -webkit-transform 0.3s;
    transition: transform 0.3s;
    -webkit-transition-timing-function: cubic-bezier(.75, 0, .125, 1);
    transition-timing-function: cubic-bezier(.75, 0, .125, 1);
    
    .lt-ie10 & {
      -ms-transform: translate(-10px);
    }
  }
  
  &:hover {
    > i {
      -webkit-transform: translate3d(-12px, 0, 0);
      transform: translate3d(-12px, 0, 0);

      .lt-ie10 & {
        -ms-transform: translate(-12px);
      }
    }

    > span {
      -webkit-transform: translate3d(2px, 0, 0);
      transform: translate3d(2px, 0, 0);

      .lt-ie10 & {
        -ms-transform: translate(2px);
      }
    }
  }
}

              
            
!

JS

              
                ###global Modernizr:true ###
'use strict'

(($) ->
  $.fn.extend
    btnBuild: (options) ->
      # js extension
      # credit: http://stackoverflow.com/questions/5075395/alternative-to-jquery-inarray
      Array::wpcIndexOf = (v) ->
        i = 0
        length = @length
        while i < length
          if typeof @[i] == 'string' and @[i].indexOf(v) > -1
            return i
          i++
        -1

      btnShikoba = ->
        # declear elements
        btnShikobaOuter = $('.btn-shikoba')

        # add fontawesom icon
        btnShikobaOuter.each ->
          $this = $(this)

          # extract fa class
          thisClassList = $this.attr('class').split(/\s+/)
          faIndex = thisClassList.wpcIndexOf('btn-shikoba--')
          
          if faIndex > -1
            faClass = 'fa-' + thisClassList[faIndex].split('--')[1]

            # warp text in <span>
            $this.wrapInner('<span />')

            # add additional elements
            faElement = '<i class="fa ' + faClass + '"></i>'
            $this.prepend faElement

            return

      # functions
      btnRipple = ->
        # declear elements
        btnRippleOuter = $('.btn-ripple')

        # create ripple elements
        btnRippleOuter.each ->
          $this = $(this)

          rippleEles = '<div class="btn-ripple__container"><span class="btn-ripple__circle"></span></div>'

          $this.append rippleEles

        # ripple effect
        $btnRippleContainer = $('.btn-ripple__container')

        $btnRippleContainer.on 'touchstart click', (e) ->
          $this = $(this)
          $offset = $this.parent().offset()
          $circle = $this.find('.btn-ripple__circle')

          x = e.pageX - $offset.left
          y = e.pageY - $offset.top

          $circle.css
            top: y + 'px'
            left: x + 'px'

          $this.addClass 'is-active'

        $btnRippleContainer.on 'animationend webkitAnimationEnd oanimationend MSAnimationEnd', (e) ->
          $(this).removeClass 'is-active'
          return

      # call functions
      btnShikoba()
      btnRipple()
      
  # END btnRipple()
      
  # call function here 
  $('.btn').btnBuild()

) jQuery

              
            
!
999px

Console