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

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 class="wrapper">
  <div class="grid">
    
    <div class="grid-cell main">
      <h2>A Big Piece of Garbage</h2>
      <p>You mean while I'm sleeping in it? And remember, don't do anything that affects anything, unless it turns out you were supposed to, in which case, for the love of God, don't not do it! Bender, you risked your life to save me!</p>
      <h3>Leela's Homeworld</h3>
      <p>No! The cat shelter's on to me. Good news, everyone! I've taught the toaster to feel love! Would you censor the Venus de Venus just because you can see her spewers? Oh, I don't have time for this.  I have to go and buy a single piece of fruit with a coupon and then return it, making people wait behind me while I complain.</p>
    </div>
    
    <div class="grid-cell sidebar">
      <h2>Kif Gets Knocked Up A Notch</h2>
      <p>Our love isn't any different from yours, except it's hotter, because I'm involved. Hey! I'm a porno-dealing monster, what do I care what you think? Oh, I always feared he might run off like this. Why, why, why didn't I break his legs? I barely knew Philip, but as a clergyman I have no problem telling his most intimate friends all about him. Throw her in the brig.</p>
    </div>
  
  </div>
</div>
              
            
!

CSS

              
                @import "compass/css3";

/* grid column size variables */
$grid-column: 60px;
$grid-gutter: 20px;

/* convert pixels to ems - defaults to 16px base */
@function em($px, $base: 16px) {
  @return ($px / $base) * 1em;
}

/* Grid based on https://github.com/necolas/griddle by Nicolas Gallagher (@necolas) */
.wrapper {
  margin-left: auto; margin-right: auto;
  padding-left: em($grid-gutter);
  padding-right: em($grid-gutter);
}

.grid {
  display: block;
  padding: 0;
  margin: 0 -0.5 * em($grid-gutter);
  text-align: left;
  letter-spacing: -0.31em;
  word-spacing: -0.43em;
  text-rendering: optimizespeed;
}

/* Note - this class uses Compass includes */
.grid-cell {
  width: 100%;
  @include inline-block;
  @include box-sizing(border-box);
  margin: 0;
  padding: 0 0.5 * em($grid-gutter);
  vertical-align: top;
  text-align: left;
  letter-spacing: normal;
  word-spacing: normal;
  text-rendering: auto;
}

/* find width of columns */
@function fixed($col) {
  @return $col * em($grid-column + $grid-gutter)
}

/* create mq to fit columns */
@mixin breakpoint($min) {
  @media (min-width: fixed($min) + em($grid-gutter)) {
    
    /* create a fixed width centered layout */
    .wrapper {
      width: fixed($min) - em($grid-gutter);
      margin-left: auto; margin-right: auto;
    } 
    
    /* css gradient overlay to help visualize columns */
    /* Note - this class uses Compass includes */
    body::after {
      content: ''; position: fixed; top: 0; bottom: 0; pointer-events: none; left: 50%;
      width: fixed($min) + em($grid-gutter); margin-left: fixed($min) / -2 - (em($grid-gutter)/2);
      @include background(linear-gradient(left, transparent $grid-gutter, transparentize(red, .8) $grid-gutter, transparentize(red, .8) $grid-gutter + $grid-column));
      @include background-size($grid-gutter + $grid-column);
    }   
    
    /* sass content block variable */
    @content
  
  }
}

/* create 5 column fixed layout */
@include breakpoint(5) {}

/* create 8 column layout with sidebar */
@include breakpoint(8) {
  .main { width: fixed(5); }
  .sidebar { width: fixed(3); }
}

/* create 12 column layout with sidebar */
@include breakpoint(12) {
  .main { width: fixed(8); }
  .sidebar { width: fixed(4); }
}
              
            
!

JS

              
                
              
            
!
999px

Console