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="grid">
  <div class="grid-item grid-item_1of12"></div>
  <div class="grid-item grid-item_1of12"></div>
  <div class="grid-item grid-item_1of12"></div>
  <div class="grid-item grid-item_1of12"></div>
  <div class="grid-item grid-item_1of12"></div>
  <div class="grid-item grid-item_1of12"></div>
  <div class="grid-item grid-item_1of12"></div>
  <div class="grid-item grid-item_1of12"></div>
  <div class="grid-item grid-item_1of12"></div>  
  <div class="grid-item grid-item_1of12"></div>
  <div class="grid-item grid-item_1of12"></div>
  <div class="grid-item grid-item_1of12"></div>    
</div>

<div class="grid">
  <div class="grid-item grid-item_3of12"></div>
  <div class="grid-item grid-item_3of12"></div>
  <div class="grid-item grid-item_3of12"></div>
  <div class="grid-item grid-item_3of12"></div> 
</div>

<div class="grid">
  <div class="grid-item grid-item_4of12"></div>
  <div class="grid-item grid-item_4of12"></div>
  <div class="grid-item grid-item_4of12"></div>
</div>

<div class="grid">
  <div class="grid-item grid-item_5of12"></div>
  <div class="grid-item grid-item_5of12"></div>
  <div class="grid-item grid-item_2of12"></div>
</div>

<div class="grid">
  <div class="grid-item grid-item_6of12"></div>
  <div class="grid-item grid-item_6of12"></div>
</div>

<div class="grid">
  <div class="grid-item grid-item_7of12"></div>
  <div class="grid-item grid-item_5of12"></div>
</div>

<div class="grid">
  <div class="grid-item grid-item_8of12"></div>
  <div class="grid-item grid-item_4of12"></div>
</div>

<div class="grid">
  <div class="grid-item grid-item_9of12"></div>
  <div class="grid-item grid-item_3of12"></div>
</div>

<div class="grid">
  <div class="grid-item grid-item_10of12"></div>
  <div class="grid-item grid-item_2of12"></div>
</div>

<div class="grid">
  <div class="grid-item grid-item_11of12"></div>
  <div class="grid-item grid-item_1of12"></div>
</div>

<div class="grid">
  <div class="grid-item grid-item_12of12"></div>
</div>
              
            
!

CSS

              
                @import "compass/css3";

@import "compass/reset";

/*
* $count = column count
* $gutter = gutter width percentage (if $gridWidth is defined, switches to pixels)
* $gridWidth = grid width (optional)
*/

@mixin gridify($count,$gutter,$gridWidth:""){ 
  
  // calculates single grid item width
  $oneGridItemWidth: 100 / $count; 
  
  //determines width of gutter if $gridWidth is defined
  @if ($gridWidth != "") {
    $gutter: ($gutter / $gridWidth) * 100;
  }
  
  //calculates excess margin equally to the column count
  $extra: $gutter / $count;
  .grid {
    //puts grid with to px if $gridWidth is defined
    @if ($gridWidth != "") {
      width: unquote($gridWidth + 'px');
    }   
    overflow: hidden;
  }
  .grid-item {
    float: left;
    box-sizing: border-box;
  }
  
  //adds gutter and converts px gutters to % if $gridWidth is defined
  .grid-item + .grid-item { margin-left: unquote($gutter + '%'); }
  
  //The loop that creates all of your grid item classes and widths
  @for $i from 1 through $count {
    .grid-item_#{$i}of#{$count} {
      width: unquote(($oneGridItemWidth * $i) - $gutter + ($extra * $i) + '%');
    }
  }
}

/**************************************
DEFINING YOUR GRID
***************************************/

/*
  You can define a grid width in pixels with a 3rd variable
  It would look like: @include gridify(12,10,960)

 DEFINING GUTTERS WITHOUT A GRID WIDTH
 your gutter will be calculated as a % if no grid px width is defined

 DEFINING GUTTERS WITH A GRID WIDTH
 if you define a grid width, your gutter will be calculated as pixels instead of percentages
*/

@include gridify(12,2); //column count, gutter, optional grid width


//Presentation Only

body {
  padding: 50px;
  background: lighten(#333333,15%);
}

.grid-item {
  padding: 20px;
  border: 5px solid lighten(#47b0e6,20%);
  background: #47b0e6;
}

.grid + .grid { margin-top: 20px; }
              
            
!

JS

              
                
              
            
!
999px

Console