css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

<button class="button  button--small  button--default">Small button</button>
<button class="button  button--small  button--success">Small success button</button>
<button class="button  button--small  button--warning">Small warning button</button>
<button class="button  button--small  button--danger">Small danger button</button>
<button class="button  button--small  button--info">Small info button</button>

<button class="button  button--default">Medium button</button>
<button class="button  button--success">Medium success button</button>
<button class="button  button--warning">Medium warning button</button>
<button class="button  button--danger">Medium danger button</button>
<button class="button  button--info">Medium info button</button>

<button class="button  button--large  button--default">Large button</button>
<button class="button  button--large  button--success">Large success button</button>
<button class="button  button--large  button--warning">Large warning button</button>
<button class="button  button--large  button--danger">Large danger button</button>
<button class="button  button--large  button--info">Large info button</button>

<button class="button  button--default  button--bold">Bold button</button>
<button class="button  button--default  button--upper">Uppercase button</button>

<button class="button  button--default  button--block">Block button</button>
              @import "compass/css3";

// Configuration
$btn-name: 'button' !default;
$btn-hover: lighten 10% !default;
$btn-border:  darken 10% !default; // Set to false for no border
$btn-size-ratio: 1.2 !default;
$btn-schemes: (
  default: #7f8c8d,
  success: #27ae60,
  danger:  #c0392b,
  warning: #f1c40f,
  info:    #2980b9
) !default;

// Color helper 
// 1. Background-color
// 2. On hover
// 3. Border-color
@mixin button-color($color) {
  $everything-okay: true;
  // Making sure $color is a color
  @if type-of($color) != color {
    @warn "`#{$color}` is not a color for `button-color`";
    $everything-okay: false;  
  // Making sure $btn-hover and $btn-border are 2 items long
  @if length($btn-hover) != 2 
   or length($btn-border) != 2 {
    @warn "Both `$btn-hover` and `$btn-border` should be two items long for `button-color`.";
    $everything-okay: false;  
  // Making sure first items from $btn-hover and $btn-border are valid functions
  @if not function-exists(nth($btn-hover, 1)) 
   or not function-exists(nth($btn-border, 1)) {
    @warn "Either `#{nth($btn-hover, 1)}` or `#{nth($btn-border, 1)}` is not a valid function for `button-color`.";
    $everything-okay: false;  
  // Making sure second items from $btn-hover and $btn-border are percentages
  @if type-of(nth($btn-hover, 2)) != number 
   or type-of(nth($btn-border, 2)) != number {
    @warn "Either `#{nth($btn-hover, 2)}` or `#{nth($btn-border, 2)}` is not a valid percentage for `button-color`.";
    $everything-okay: false;  
  // If there is no mistake
  @if $everything-okay == true {
    background-color: $color; // 1
    &:active { // 2
      background: call(nth($btn-hover, 1), $color, nth($btn-hover, 2));
    @if $btn-border != false { // 3
      border-color: call(nth($btn-border, 1), $color, nth($btn-border, 2));

// Default class
// 1. Border or not border?
// 2. Large modifier
// 3. Small modifier
// 4. Bold modifier
// 5. Block modifier
// 6. Uppercase modifier
// 7. Color themes modifier
.#{$btn-name} {
  // Default styles
  padding: .5em;
  margin-bottom: 1em;
  color: #fff;
  transition: background .15s;
  box-shadow: inset 0 1px rgba(255, 255, 255, .2);
  border-radius: .15em;
  border: if($btn-border != false, 1px solid, none); // 1
  // Modifiers
  &--large { // 2
    font-size: 1em * $btn-size-ratio;
  &--small { // 3
    font-size: 1em / $btn-size-ratio;

  &--bold { // 4
    font-weight: bold;
  &--block { // 5
    display: block;
    width: 100%;
  &--upper { // 6
    text-transform: uppercase;
  @each $key, $value in $btn-schemes { // 7
    &--#{$key} {
      @include button-color($value);

// Demo
body {
  padding: 1em;
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................