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.

            
              - var btns = ['primary','secondary','success','danger','warning','info','light','dark','link','lg','sm','brand-primary','brand-secondary','brand-tertiary'];
.container
  .card.mt-5
    .card-header
      h1.display-4 Auto Custom Bootstrap 4 Buttons
    .card-body
      each val in btns
        button(class='btn btn-' + val)= val
            
          
!
            
              //Colors - Any Colors You Want
$colors: (
  primary: #00a9e7,
  secondary: #09e3fe,
  success: #37ff3b,
  danger: #ee3426,
  warning: #e4de33,
  info: #00a9e7,
  light: #eee,
  dark: #444,
  brand-primary: #420dab, 
  brand-secondary: #36418c, 
  brand-tertiary: #c0d6e4
);

//Dark or Light background to determine text color
@function text-color($color) {
  @if (lightness($color) > 50) {
    @return #000; // Lighter backgorund, return dark color
  } @else {
    @return #fff; // Darker background, return light color
  }
}

//Bootstrap Button - Make Any Customizations Here
@mixin custom-bootstrap-btns {
  //Generates the class names via the $colors Map
  @each $className in $colors {
    .btn-#{nth($className, 1)} {
      $buttonColor: nth($className, 2);
      background: $buttonColor;
      color: text-color($buttonColor);
      border-color: darken($buttonColor, 5%);
      &:hover {
        background: lighten($buttonColor, 10%);
        color: text-color(lighten($buttonColor, 10%));
        border-color: $buttonColor;
      }
    }
  }
  //Button Sizes
  .btn {
    &-lg {
      //Any Size Customizations here
    }
    &-sm {
      //Any Size Customizations here
    }
    &-link {
      //Any Customizations here
    }
  }
}

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

//Layout for Pen
body {
  background: #222;
}
button {
  margin: 10px;
  cursor: pointer;
}
            
          
!
            
              //Auto Custom Bootstrap 4 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
            
          
!
999px
Loading ..................

Console