Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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="wrapper">

  <div class="row">
    <div class="col-12">
      <h1><span><i>{</i> <b>Dynamic</b> SASS <b>Grid</b> <i>}</i></span> <a href="https://twitter.com/thecssguru" target="_blank"><i>{</i> <b>the</b>CSS<b>guru</b> <i>}</i></a></h1>
    </div>
  </div>
        
  <div class="row">
    <div class="col-12"><span>940</span></div>
  </div>
  
  <div class="row">
    <div class="col-1"><span>60</span></div>
    <div class="col-11"><span>860</span></div>
  </div>
  
  <div class="row">
    <div class="col-2"><span>140</span></div>
    <div class="col-10"><span>780</span></div>    
  </div>
  
  <div class="row">
    <div class="col-3"><span>220</span></div>
    <div class="col-9"><span>700</span></div>    
  </div>
  
  <div class="row">
    <div class="col-4"><span>300</span></div>
    <div class="col-8"><span>620</span></div>    
  </div>
  
  <div class="row">
    <div class="col-5"><span>380</span></div>
    <div class="col-7"><span>540</span></div>    
  </div>
  
  <div class="row">
    <div class="col-6"><span>460</span></div>
    <div class="col-6"><span>460</span></div>    
  </div>
  
  <div class="row">
    <div class="col-6">
      <div class="row">
        <div class="col-1 alpha"><span>60</span></div>
        <div class="col-1"><span>60</span></div>
        <div class="col-4 omega"><span>300</span></div>
      </div>
    </div>
    <div class="col-6">
      <div class="row">
        <div class="col-1 alpha"><span>60</span></div>
        <div class="col-5 omega"><span>380</span></div>
      </div>
    </div>    
  </div>
  
  <div class="row">
    <div class="col-9">
      <div class="row">
        <div class="col-1 alpha"><span>60</span></div>
        <div class="col-1"><span>60</span></div>
        <div class="col-3"><span>220</span></div>
        <div class="col-4 omega"><span>300</span></div>
      </div>
    </div>
    <div class="col-3">
      <div class="row">
        <div class="col-1 alpha"><span>60</span></div>
        <div class="col-2 omega"><span>140</span></div>
      </div>
    </div>    
  </div>
  
</div>
              
            
!

CSS

              
                @import compass

//Dynamic SASS Grid Created by theCSSguru
$gridWidth    :  960px //Site Width
$gridGut      :  20px  //Gutter Size
$gridColumns  :  12    //Column Count
$i            :  $gridColumns

=col($col: 1)
  width: (($gridWidth / $gridColumns) * $col) - $gridGut

@while $i > 0
  .col-#{$i}
    +col($i)
  $i: $i - 1
  
[class^=col]
  margin: 0 ($gridGut /2)
  display: inline
  float: left
.alpha
  margin-left: 0
.omega
  margin-right: 0
.row
  overflow: hidden
  position: relative

//-------------------------------------------------------
//-------------------------------------------------------
//-------------------------------------------------------

//Fonts
$headFont: 'Average', serif

//Imports
@import url(https://fonts.googleapis.com/css?family=Average)

//Layout
body
  background: #111
  font: 88% Arial
.wrapper
  +border-radius(10px)
  background: rgba(255,255,255,0.3)
  padding: ($gridGut / 2) 0 0
  margin: 35px auto
  overflow: hidden
  width: $gridWidth
  i, b, em
    &:before
      display: inline-block
  h1
    +border-radius(10px)
    background: #fff
    overflow: hidden
    font-family: $headFont
    font-weight: normal
    color: #c0fdfd
    margin: 0
    padding: ($gridGut / 2)
    position: relative
    span
      +border-radius(10px)
      background: #000
      display: block
      float: left
    i
      color: #fd00fd
      font-style: normal
    b
      color: #fff
      font-weight: normal
    a
      +border-radius(10px)
      background: #000
      color: #c0fdfd
      text-decoration: none
      display: block
      padding: ($gridGut / 2)
      float: right
      &:hover
        background: #444
  .row
    margin: 0 0 ($gridGut / 2)
    .row
      margin: 0
      background: #000
      +border-radius(10px)
  [class^=col]
    +border-radius(10px)
    background: #fff
    span
      display: block
      padding: ($gridGut / 2)
      text-align: center

//All Box Sizing & Font Smoothing on Everything
*
  -moz-box-sizing: border-box
  -webkit-box-sizing: border-box
  box-sizing: border-box
  font-smooth: always
  -webkit-font-smoothing: antialiased
              
            
!

JS

              
                /* Notes:

If you want to change the column count and have it show correctly below, you'll have to copy and paste new Grid row and col's in the HTML. So say you change 12 columns to 16, you'll have to write new HTML like:

  <div class="row">
    <div class="col-16"><span>Anything</span></div>
  </div>

The <span> is only there to add padding and centering of the text.

I hope you enjoy this Dynamic Grid built with SASS :)

Follow me on twitter and hit me up sometime, oh and let me know if you end up using it, thanks!

~ theCSSguru

*/
              
            
!
999px

Console