CodePen

HTML

            
              <h1>Grids <em>Because Chris said they're cool</em></h1>

<div class="wrapper">
  <section class="primary-content">
    <div class="module">
      <h3>Primary Content</h3>
      <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>  
    </div>
  </section>
  
  <aside class="secondary-content">
    <div class="module">
      <h3>Secondary Content</h3>
      <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>  
    </div>
  </aside>
</div>
            
          
!

CSS

            
              $spacing: 20px; /* General Spacing Value */

/* 
   ==================================================
   General Setup
   ==================================================
*/
*
{
  @include box-sizing(border-box); /* Set up box-sizing */
}

body
{
  padding: 10px 50px 200px 50px;
  background: url(http://subtlepatterns.com/patterns/dark_wall_@2X.png);
  background-size: 300px 300px;
}

h1
{
  color: white;
  em 
  {
    color: #666;
    font-size: 16px;
  }
}

/* 
   ==================================================
   Grid Mixins
   ==================================================
*/
@mixin grid-context($padding: false)
{
  margin: 0 0 $spacing 0;
  @if ($padding)
  {
    padding: $spacing 0 $spacing $spacing;
  }
  
  
  & > *
  {
    float: left;
    padding-right: $spacing;
   
    @if ($padding == false)
    {
      &:last-child
      {
        padding-right: 0;
      }
    }
  }
  
  &:after
  {
    content: "";
    display: table;
    clear: both;
  }
}

@mixin grid-size($fraction)
{
  width: $fraction * 100%;
}

/* 
   ==================================================
   Example Usage
   ==================================================
*/
.wrapper
{
  @include grid-context(true);
  background: white;
}

.primary-content
{
  @include grid-size(2/3);
}

.secondary-content
{
  @include grid-size(1/3);
}

.module
{
  padding: $spacing;
  background: #eeeeee;
  color: #000;
}
            
          
!
? ?
? ?
Must be a valid URL.
+ add another resource
via CSS Lint

JS

            
              
            
          
!
Must be a valid URL.
+ add another resource
via JS Hint
Loading ..................