octocatstartv

Don't Overthink It Grids

A Pen By Captain Anonymous

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Want a Run Button?

If active, the preview will update automatically when you change code.

            
              <h1>Don't Overthink It Grids <em>(while we wait for flexbox!)</em></h1>

<div class="grid">
   <div class="col-2-3">
     <div class="module">
       <h3>2/3</h3>			<p>BIDFIK roolbool rackorack op deenoopaloomba ka jandalop me pep google lopski perfect preference group call later go take foot pep universal.</p>	
     </div>
   </div>
   <div class="col-1-3">
     <div class="module">
     		<h3>1/3</h3>
				<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies</p>	
     </div>
   </div>
</div>

<div class="grid grid-pad">
   <div class="col-2-3">
     <div class="module">
     		<h3>2/3 (Opt-in Outside Padding)</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>
   </div>
   <div class="col-1-3">
     <div class="module">
     		<h3>1/3</h3>
				<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam.</p>	
     </div>
   </div>
</div>

<div class="grid grid-pad">
   <div class="col-1-8">
     <div class="module">
     		<h3>1/8</h3>
     </div>
   </div>
   <div class="col-1-8">
     <div class="module">
     		<h3>1/8</h3>
     </div>
   </div>
  <div class="col-1-8">
     <div class="module">
     		<h3>1/8</h3>
     </div>
   </div>
  <div class="col-1-8">
     <div class="module">
     		<h3>1/8</h3>
     </div>
   </div>
  <div class="col-1-8">
     <div class="module">
     		<h3>1/8</h3>
     </div>
   </div>
  <div class="col-1-8">
     <div class="module">
     		<h3>1/8</h3>
     </div>
   </div>
  <div class="col-1-8">
     <div class="module">
     		<h3>1/8</h3>
     </div>
   </div>
  <div class="col-1-8">
     <div class="module">
     		<h3>1/8</h3>
     </div>
   </div>
</div>

<div class="grid grid-pad">
   <div class="col-1-4">
     <div class="module">
     		<h3>1/4</h3>
     </div>
   </div>
   <div class="col-1-2">
     <div class="module">
     		<h3>1/2</h3>
     </div>
   </div>
  <div class="col-1-4">
     <div class="module">
     		<h3>1/4</h3>
     </div>
   </div>
</div>
            
          
!
            
              @import "compass/css3";

* {
  @include box-sizing(border-box);
}

$pad: 20px;

.grid {
  background: white;
  margin: 0 0 $pad 0;
  
  &:after {
    /* Or @extend clearfix */
    content: "";
    display: table;
    clear: both;
  }
}

[class*='col-'] {
	float: left;
  padding-right: $pad;
  .grid &:last-of-type {
  	padding-right: 0;
  }
}
.col-2-3 {
	width: 66.66%;
}
.col-1-3 {
	width: 33.33%;
}
.col-1-2 {
	width: 50%;
}
.col-1-4 {
	width: 25%;
}
.col-1-8 {
	width: 12.5%;
}

.module {
  padding: $pad;
  background: #eee;
}

/* Opt-in outside padding */
.grid-pad {
  padding: $pad 0 $pad $pad;
  [class*='col-']:last-of-type {
    padding-right: $pad;
  }
}

body {
	padding: 10px 50px 200px;
  background: url(http://s.cdpn.io/3/dark_wall_@2X.png);
  background-size: 300px 300px;
}
h1 {
  color: white;
  em {
  	color: #666;
    font-size: 16px;
  }
}
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console