octocatstartv

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.

            
              <div class="wrapper">
  <h1>Auto Custom Bootstrap Buttons</h1>
  <a href="" class="btn">Read More</a>
  <a href="" class="btn btn-primary">Read More</a>
  <a href="" class="btn btn-info">Read More</a>
  <a href="" class="btn btn-success">Read More</a>
  <a href="" class="btn btn-warning">Read More</a>
  <a href="" class="btn btn-danger">Read More</a>
  <a href="" class="btn btn-inverse">Read More</a>
  <a href="" class="btn btn-large">Read More</a>
  <a href="" class="btn btn-small">Read More</a>
  <a href="" class="btn btn-mini">Read More</a>
</div>
            
          
!
            
              @import "compass";

//Colors
$primaryColor: #0156A0; //Blue
$secondaryColor: #02A7AB; //Aqua
$tertiaryColor: #666666; //Grey

%fade {
  @include transition(all, 0.5s ease-in-out);
}

//Bootstrap Button - Custom
@mixin custom-bootstrap-btns {
  //Button Text Color
  %lightTextColor { color: darken(#fff, 50%); }
  %darkTextColor { color: #fff; }
  //Button Styles
  .btn {
    @extend %fade;
    $buttonColor: #fff;
    font-size: 14px; @extend %lightTextColor; text-transform: uppercase; text-decoration: none;
    padding: 15px 45px; margin: 0;
    border: none;
    background: $buttonColor;
    position: relative;
    display: inline-block;
    &:hover {
      @extend %darkTextColor;
      background: lighten($primaryColor, 20%);
      text-decoration: none;
    }
    &:focus {
      @extend %lightTextColor;
      outline: none;
    }
  }
  //Button Colors
  $buttonColors: primary #005888, info #49AFCD, success #5BB75B, warning #FAA732, danger #DA4F49, inverse #363636, primaryColor $primaryColor, secondaryColor $secondaryColor, tertiaryColor $tertiaryColor;
  @each $className in $buttonColors {
    .btn-#{nth($className, 1)} {
      $buttonColor: nth($className, 2);
      @extend %darkTextColor;
      background: $buttonColor;
      &:hover {
        @extend %darkTextColor;
        background: lighten($buttonColor, 10%);
      }
    }
  }
  //Button Sizes
  .btn-large {
    font-size: 18px;
    padding: 12px 22px 10px;
  }
  .btn-small {
    font-size: 11px;
    padding: 8px 16px 6px;
  }
  .btn-mini {
    font-size: 9px;
    padding: 7px 12px 5px;
  }
  .btn-link {
    background: none;
    padding: 0;
    border-radius: 0;
    border: none;
  }
}

//Boostrap Custom Buttons Mixin Call
@include custom-bootstrap-btns;

//Layout Stuff
body {
  background: url('http://thecssguru.freeiz.com/animate/bg.png');
}
.wrapper {
  width: 525px;
  margin: 50px auto; padding: 25px;
  overflow: hidden;
  background: rgba(white, 0.8);
  border-radius: 10px;
  h1 {
    font: bold 28px Helvetica;
    margin: 0 10px 10px;
  }
  a {
    margin: 10px;
    display: block;
    float: left;
  }
}
            
          
!
            
              //Auto Custom Bootstrap Buttons

//Created a Mixn so it can be stored in a partial, but doesn't have to be.

//The Mixin generates all the classes you need via the @each function

//Gives you complete control on how you want your custom buttons to look like, while using all the lovely bootstrap class names for buttons. Go ahead and play with the CSS to create your own custom buttons

//I had fun making this, btw, I am linking to the bootstrap.css via github for the core styling.

$('a').click(function(){
  return false
  //just so you can click the buttons without reload
});
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console