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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                %div.wrap
    
    %div.grid.cols-1-3-6-16
        -(1..10).each do |i|
            %div
        %div.span-4
        %div.span-2
        %div.span-2
        -(1..7).each do |i|
            %div

    %div.grid.cols-1-8
        %div.span-6
        %div.span-2
    
    %div.grid.cols-1-8.switched
        %div.span-6
        %div.span-2
              
            
!

CSS

              
                @import "compass/css3";

//Breakpoints 
$small:480px;
$medium:768px;
$large:1024px;

// Grid Selectors
$grid:".grid";
$grid-item: "div";

$defaultGutter:2.5%;

// Grid Mixin ex. 3 columns with a 2.5% gutter: @include grid-cols(3); 

@mixin grid-cols($cols, $gutter:$defaultGutter, $grid-item:$grid-item){

   $colSpace: 100% - ($gutter * $cols);
   
   $width: $colSpace / $cols;
   
  
   width:100% + $gutter;  
   margin-left: - $gutter;

   > #{$grid-item}{
   
       width:$width;
       margin-left:$gutter;
   }

 
 @for $i from 2 through $cols {
     
     $thisWidth:($width * $i) + $gutter * ($i - 1);
      
       // get rid of any grid items over 100% we wont need i.e .span-4 on a 3 column grid.
      
        @if($thisWidth < 100){
      
         > #{$grid-item}.span-#{$i}{
      
            width:$thisWidth;
   
         }
      }   
        
   }

}


#{$grid}{
  
 margin:1em 0; 
 clear:both;
  
  // demo cf
  &:before,
  &::after {
    content: " "; 
    display: table; 
  }

  &:after {
    clear: both;
  }  
  
 #{$grid-item}{
    width:100%;
    // demo styles
    margin:1em 0;
    height:100px;
    background:#333;
    float:left;
  }

  &.switched{
    #{$grid-item}{
      float:right;
    }
  }
  
  &.cols-1-3-6-16{
    @media (min-width: $small) {
        @include grid-cols(3);
      }
    @media (min-width: $medium) {
        @include grid-cols(8, 3.5%);
     }
    @media (min-width: $large) {
        @include grid-cols(10, 1%);
     }
  }

  &.cols-1-8{
    @media (min-width: $medium) {
       @include grid-cols(8);
    }
  }
}


//Extra demo Styles
.wrap{
   width:80%;
   margin:0 auto;
}
 
  

              
            
!

JS

              
                /*
Example grid system (the big bizzle gridizzle)

cols-1-3-6-16

one column before first breakpoint.

three cols after the first

six cols after the second

ten cols after the third 

.span class indicates how many columns a .grid item spans

Based on "building better grids" by a nice guy called Harry Roberts (the grid not the naming convention which needs some work!). 

Just pass the percentage gutter and the number of columns you would like to the mixin, voila.

http://stackoverflow.com/questions/14435927/skipping-an-optional-argument-in-sass-mixin

*/
              
            
!
999px

Console