cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

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.

            
              <div class="ie7">
  <h2>@include grid(3);</h2>
  <div class="grid grid-3">
      <div>
        <div>1</div><!-- Media Block Content Goes Here -->
      </div> <!-- /media-block -->
      <div>
        <div>2</div><!-- Media Block Content Goes Here -->
      </div> <!-- /media-block -->
      <div>
        <div>3</div><!-- Media Block Content Goes Here -->
      </div> <!-- /media-block -->
  </div> <!-- /two-up -->

  <h2>@include grid(25% 50% 25%, 5px, ".ui-item");</h2>
  <div class="grid grid-25-50-25">
      <div class="ui-item">
        <div>1</div><!-- Media Block Content Goes Here -->
      </div> <!-- /media-block -->
      <div class="ui-item">
        <div>2</div><!-- Media Block Content Goes Here -->
      </div> <!-- /media-block -->
      <div class="ui-item">
        <div>3</div><!-- Media Block Content Goes Here -->
      </div> <!-- /media-block -->
  </div> <!-- /two-up -->

  <h2>@include grid(10% 30% 10% 40% 10%);</h2>
  <div class="grid grid-5-complex">
      <div class="ui-item">
        <div>1 10%</div><!-- Media Block Content Goes Here -->
      </div> <!-- /media-block -->
    <div class="ui-item">
        <div>2 30%</div><!-- Media Block Content Goes Here -->
      </div> <!-- /media-block -->
    <div class="ui-item">
        <div>3 10%</div><!-- Media Block Content Goes Here -->
      </div> <!-- /media-block -->
    <div class="ui-item">
        <div>4 40%</div><!-- Media Block Content Goes Here -->
      </div> <!-- /media-block -->
    <div class="ui-item">
        <div>5 10%</div><!-- Media Block Content Goes Here -->
      </div> <!-- /media-block -->
  </div> <!-- /five-up -->

  <h2>Responsive breakpoints with proper clearing: grid(2); grid(3); grid(4);</h2>
  <div class="grid grid-responsive">
      <div class="ui-item">
        <div>1</div><!-- Media Block Content Goes Here -->
      </div> <!-- /media-block -->
      <div class="ui-item">
        <div>2 Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus hendrerit. Pellentesque aliquet nibh nec urna. In nisi neque, aliquet vel, dapibus id, mattis vel, nisi. Sed pretium, ligula sollicitudin laoreet viverra, tortor libero sodales leo, eget blandit nunc tortor eu nibh. Nullam mollis. Ut justo. Suspendisse potenti.</div><!-- Media Block Content Goes Here -->
      </div> <!-- /media-block -->
      <div class="ui-item">
        <div>3</div><!-- Media Block Content Goes Here -->
      </div> <!-- /media-block -->
        <div class="ui-item">
        <div>4</div><!-- Media Block Content Goes Here -->
      </div> <!-- /media-block -->
      <div class="ui-item">
        <div>5 Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus hendrerit. Pellentesque aliquet nibh nec urna. In nisi neque, aliquet vel, dapibus id, mattis vel, nisi. Sed pretium, ligula sollicitudin laoreet viverra, tortor libero sodales leo, eget blandit nunc tortor eu nibh. Nullam mollis. Ut justo. Suspendisse potenti.</div><!-- Media Block Content Goes Here -->
      </div> <!-- /media-block -->
      <div class="ui-item">
        <div>6</div><!-- Media Block Content Goes Here -->
      </div> <!-- /media-block -->
  </div> <!-- /two-up -->

  <h2>@include grid(4, 2.5%);</h2>
  <div class="grid grid-4">
      <div class="ui-item">
        <div>1</div><!-- Media Block Content Goes Here -->
      </div> <!-- /media-block -->
    <div class="ui-item">
        <div>2</div><!-- Media Block Content Goes Here -->
      </div> <!-- /media-block -->
    <div class="ui-item">
        <div>3</div><!-- Media Block Content Goes Here -->
      </div> <!-- /media-block -->
    <div class="ui-item">
        <div>4</div><!-- Media Block Content Goes Here -->
      </div> <!-- /media-block -->
  </div> <!-- /five-up -->
</div>

            
          
!
            
              * {
  box-sizing: border-box;
}

@mixin clearfix {
  &:after {
    content: "";
    display: table;
    clear: both;
  }
}

//Upbase variables
$support-ie7: true;
$ie-conditional-classes: true;
$grid-target: '*' !default;

@mixin grid(
  $items: 2,
  $gutter: 20px,
  $target: $grid-target ) {

  //Variables
  $list-length: length($items);
  $items-per-row: null; //determined later in mixin, globally defined here

  //Parent container styles
  @include clearfix;
  margin-left: -#{$gutter};

  //Child grid styles
  //If length of items list is gt 1, means multi-column widths provided
  @if $list-length > 1 {
    $items-per-row: $list-length;
    @for $i from 1 through $list-length {
      $item-size: nth($items, $i);
      > #{$target}:nth-child(#{$i}) {
        float: left;
        padding-left: #{$gutter};
        width: $item-size;
        @if $support-ie7 == true and $ie-conditional-classes == true {
          .ie7 & {
            width: floor($item-size);
          }
        }
      }
    }
  } @elseif $list-length == 1 {
    //If length of list is 1, use evenly-sized items
    $items-per-row: $items;
    $item-size: 100% / $items;
    > #{$target} {
      float: left;
      padding-left: #{$gutter};
      width: $item-size;
      @if $support-ie7 == true and $ie-conditional-classes == true {
        .ie7 & {
          width: floor($item-size);
        }
      }
    }
  }

  //Clears all clears; when used across media queries, for example
  & > #{$target}:nth-child(1n) {
    clear: none;
  }

  //Clear first item in each row
  $items-per-row-n: $items-per-row + 'n';
  & > #{$target}:nth-child( #{$items-per-row-n} + 1 ) {
    clear: both;
  }

}



//Generic supporting styles
* { color: #444; font-family: "Source Sans Pro"; font-weight: normal }
.grid { margin-bottom: 50px }
.ui-item, .grid > div { margin-bottom: 10px }
.grid > div > div {
  background-color: #bada55;
  color: darken(#bada55, 25%);
  min-height: 100px;
  padding: 10px;
}

// ============================================= //
// grid Usage					   		             //
// ============================================= //

.grid-3 {
  @include grid(3);
}

.grid-25-50-25 {
  @include grid(25% 50% 25%, 5px, ".ui-item");
}

.grid-4 {
  @include grid(4, 2.5%);
}

.grid-5-complex {
  @include grid(10% 30% 10% 40% 10%);
}

.grid-responsive {
  @include grid(2);
  @media screen and (min-width: 768px) {
    @include grid(3);
  }
  @media screen and (min-width: 1000px) {
    @include grid(4);
  }
}



            
          
!
999px
Loading ..................

Console