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.

              <section class="grid clear">
  <div class="col-tiny-6 col-large-4">a</div>
  <div class="col-tiny-6 col-large-8">b</div>

<section class="grid clear">
  <div class="col-small-4 col-large-2">a</div>
  <div class="col-small-4 col-large-5">b</div>
  <div class="col-small-4 col-large-5">c</div>

<section class="grid clear">
  <div class="col-tiny-3 col-large-2">a</div>
  <div class="col-tiny-3 col-large-2">b</div>
  <div class="col-tiny-3 col-large-4 col-nation-4">c</div>
  <div class="col-tiny-3 col-large-4 col-nation-4">d</div>

<section class="grid clear">
  <div class="col-tiny-6 col-galaxy-3">a</div>
  <div class="col-tiny-6 col-galaxy-3">b</div>
  <div class="col-tiny-4 col-galaxy-2">c</div>
  <div class="col-tiny-4 col-galaxy-2">d</div>
  <div class="col-tiny-4 col-galaxy-2">e</div>

<section class="clear">
  <div class="col-tiny-flush-4">a</div>
  <div class="col-tiny-flush-4">b</div>
  <div class="col-tiny-flush-4">c</div>

              // ================
// Variables
// ================

// Number of columns the grid is based off of
$column-base: 12;

// Half the space between each column
// Defines the bottom margin of each column
$column-between: 1%;

// Do you need to utilize the default feature of this grid system?
$column-default-desired: true;

// Do you need to utilize the flush feature of this grid system?
$column-flush-desired: true;

// Do you need to utilize the push feature of this grid system?
$column-push-desired: false;

// Create a sass map to store breakpoint aliases & respective values
$breakpoints: (
  'tiny': 400px,
  'small': 500px,
  'medium': 600px,
  'big': 700px,
  'large': 800px,
  'huge': 900px,
  'nation': 1000px

// ================
// Property Dependency
// ================

// !: The grid will break without this
// !: Make sure this property is at least being applied to your grid and columns
* {
  box-sizing: border-box;

// ================
// Clear
// ================

.clear {
  &:after {
    clear: both;
    display: table;
    content: '';

// ================
// Grid
// ================

// 1: All grids have their right and left margins pulled outward by default
// 1: This ensures that the columns inside will be flush with the grid container
.grid {
  display: flex;
  flex-wrap: wrap;
  margin-right: $column-between * -1;
  margin-left: $column-between * -1;

// ================
// Columns
// ================

// 1: All columns must begin with the class of 'col' within your markup
// 1: If the dependency on that class string is low, you may change the '^' filter to '*'

// 2: Or change this to a generic class rather than a filtered selector
// 2: All columns are float left by default
// 2: This reduces the amount of float declarations and media queries without sacrificing integrity

// 3: All columns have right and left margins pushed inward by default
// 3: This reduces the amount of margin declarations and media queries without sacrificing integrity
// 3: The grid container will stretch these back out so that each column will appear full width by default
[class^='col-'] {
  float: left;
  margin: 0 $column-between $column-between * 2;
  width: 100% - $column-between * 2;

[class*='flush'] {
  margin-right: 0;
  margin-left: 0;
  width: 100%;

// Iterates through a loop given the amount of breakpoints with $breakpoints
// Example class output: .col-small-4, .col-large-push-4, .col-nation-pull-4
@for $i from 1 to length($breakpoints) + 1 {

  // Iterates through each breakpoint within $breakpoints
  @media (min-width: nth(nth($breakpoints, $i), 2)) {

    @for $x from 1 to $column-base {
      @if $column-default-desired {

        // Given the index of this loop, how many columns does that take up?
        .col-#{nth(nth($breakpoints, $i), 1)}-#{$x} {
          width: 100% / $column-base * $x - $column-between * 2;
      // Create 'flush' classes *if* $column-flush-desired is set to true
      @if $column-flush-desired {
        .col-#{nth(nth($breakpoints, $i), 1)}-flush-#{$x} {
          width: 100% / $column-base * $x;
      // Create 'push' classes *if* $column-push-desired is set to true
      @if $column-push-desired {
        // Push classes push a column x number of columns on it's left
        // Given the index of this loop, how many columns does this push on the left?
        .col-#{nth(nth($breakpoints, $i), 1)}-push-#{$x} {
          margin-left: 100% / $column-base * $x + $column-between;



// ================
// Visuals @u@
// ================

body {
  padding: $column-between * 2;

  [class^='col'] {
    padding: 1.25em;
    background: #6ecdc7;
    color: #fff;
    @at-root .grid:nth-of-type(odd) [class^='col'] {
      background: darken(#6ecdc7, 20%);

  .flex-item {
    padding: 1.25em;
    background: #000;
    color: #fff;
🕑 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 ..................