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

              
                <button class="button1">Button 1</button>
<button class="button2">Button 2</button>
<button class="button3">Button 3</button>
<button class="button4">Button 4</button>
<button class="button5">Button 5</button>

<!-- note to self:
      Mixin writing tips: do all of your if statements at the begining and save the result as a variable if you can -- this will declutter your code alot -->
              
            
!

CSS

              
                @import "compass/css3";

@import "compass/utilities/color/contrast";

// color-contrast preferences
$contrasted-dark-default: #333333;
$contrasted-light-default: #e7e7e7;
$contrasted-lightness-threshold: 50%;
  
@mixin button($color, $size) {
  //defaults:
  $push-height: 2px;
  $border-color: darken($color, 40%);
  $font-size: 1em;
  
  // a larger button has a bigger area of movement and font-size
  @if $size == "big" {
    $push-height: 6px;
    $font-size: 1.5em;
  }

  //the following determine how dark to make the bottom-border of the button depending on the lightness of the actual background color of the button
  @if lightness($color) < 20%{
    $border-color: darken($color, 80%);
  }
  @if lightness($color) > 80%{
    $border-color: darken($color, 10%);
  }

  @include contrasted($color); //this is magical
	border: none; //as a reset
  border-bottom: $push-height*2 $border-color solid;
	font-size: $font-size;
	margin-top: 0; //must start at 0 bc movement illusion achieved via margin-top
	padding: 0.4em 2em;
  position: absolute;
	&:hover {
		margin-top: $push-height;
    border-bottom: $push-height $border-color solid;
    background-color: lighten($color, 5%);
	}
	&:active, &:focus {
    outline-color: transparent; //reset styling
    outline-style: none; //reset styling
		border-bottom: none; //reset styling
		margin-top: $push-height*2;
		margin-bottom:-2px;
	} 
}

//COLORS!
$toad-blue: #93d0ff;
$bowser-red: #741b0b;
$peach-pink: #feb8c6;
$yoshi-green: #3b8f47;
$boo-purple: #2c2d4b;

.button1 {
  @include button($toad-blue, big);
}

.button2 {
  @include button($bowser-red, small);
  left: 250px;
}

.button3 {
  @include button($peach-pink, big);
  left: 400px;
}

.button4 {
  @include button($yoshi-green, small);
  left: 100px;
  top: 100px;
}

.button5 {
  @include button($boo-purple, big);
  left: 300px;
  top: 100px;
}
              
            
!

JS

              
                
              
            
!
999px

Console