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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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 flex">
  <div class="red box flex--child_3 center flex v-center"></div>
  <div class="red box flex--child_4 center flex v-center"></div>
  <div class="red box flex--child_4 center flex v-center"></div>
  <div class="red box flex--child_4 center flex v-center"></div>
  <div class="red box flex--child_5 center flex v-center"></div>
</div>
<div class="container flex">
  <div class="blue box flex--child_4 center flex v-center"></div>
  <div class="blue box flex--child_4 center flex v-center"></div>
  <div class="blue box flex--child_4 center flex v-center"></div>
  <div class="blue box flex--child_4 center flex v-center"></div>
  <div class="blue box flex--child_1 center flex v-center"></div>
</div>
<div class="container flex">
  <div class="slate box flex--child_3 center flex v-center"></div>
  <div class="slate box flex--child_2 center flex v-center"></div>
  <div class="slate box flex--child_1 center flex v-center"></div>
  <div class="slate box flex--child_3 center flex v-center"></div>
  <div class="slate box flex--child_2 center flex v-center"></div>
  <div class="slate box flex--child_2 center flex v-center"></div>
  <div class="slate box flex--child_1 center flex v-center"></div>
  <div class="slate box flex--child_1 center flex v-center"></div>
</div>
<div class="container flex">
  <div class="yellow box flex--child_5 center flex v-center"></div>
  <div class="yellow box flex--child_4 center flex v-center"></div>
  <div class="yellow box flex--child_3 center flex v-center"></div>
  <div class="yellow box flex--child_2 center flex v-center"></div>
  <div class="yellow box flex--child_1 center flex v-center"></div>
</div>
<div class="container flex">
  <div class="green box flex--child_5 center flex v-center"></div>
  <div class="green box flex--child_1 center flex v-center"></div>
  <div class="green box flex--child_5 center flex v-center"></div>
</div>
<div class="container flex">
  <div class="orange box flex--child_1 center flex v-center"></div>
  <div class="orange box flex--child_1 center flex v-center"></div>
</div>
<div class="container flex">
  <div class="purple box flex--child_2 center flex v-center"></div>
  <div class="purple box flex--child_2 center flex v-center"></div>
  <div class="purple box flex--child_1 center flex v-center"></div>
</div>

              
            
!

CSS

              
                $red: #FF4136;
$blue: darken(mix(#39CCCC, #7FDBFF), 15%);
$yellow: #ffba10;
$green-1: darken(#99E15A, 5%);
$green-2: mix(#3D9970, #2ECC40);
$green: mix($green-1, $green-2);
$orange: #ff4c00;
$purple: #9d5973;
$gray: #3c3c3c;
$slateblue: #70ACB5;

$y: 10 !default;

$colors: slate $slateblue, red $red, green $green, blue $blue, yellow $yellow, orange $orange, purple $purple;
$number-of-colors: length($colors);
*:before, *:after {
  box-sizing: border-box;
}
@mixin shady($c) {
  @for $i from 1 through $y {
    $j: $i - 1;
    @if $j == 0 {
      &:nth-child(#{$i}) { background: $c; }
    }
    @else {
      &:nth-child(#{$i}) { background: lighten($c, ($j * 2.5%)); }
    }
  }
}


@each $color in $colors {
  .#{nth($color, 1)} { @include shady(nth($color, 2)); }
}

.hl { 
  font: 300 1.5rem/1 Avenir, Helvetica Neue;
  color: white;
  width: 100%;
}

.box { margin: 0; }
.center { text-align: center; }
.v-center { align-items: center; }

.container {
  width: 100%;
  height: (100/$number-of-colors)*1vh;
}

.flex {
  display: flex;
  @for $i from 1 through $y {
    &--child {
      &_#{$i} {
        flex: $i;
        position: relative;
        &::after {
          content: "#{$i}";
          position: absolute;
          height: (100/$number-of-colors)*1vh;
          padding: 6vh 0;
          font: 300 1.5rem/1 Avenir, Helvetica Neue;
          color: white;
          width: 100%;
        }
       }
    }
  }
}

              
            
!

JS

              
                
              
            
!
999px

Console