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

              
                <header>
  <h1>CSS Grid Layout</h1>
  <p class="lead">Basic grid layouts to get you familiar with building without a pre-built grid system.</p>
</header>

<h3>Full width, single column</h3>
<p class="text-warning">No grid classes are necessary for full-width elements.</p>

<div style="border: 1px solid rgba(86,61,124,0.2); padding: 15px;">Full width element, please!</div>

<h3>Three equal columns</h3>
<p>Get three equal-width columns. On mobile devices, tablets and below, the columns will automatically stack. Plus, we don't have to use any cryptic class names.</p>

<div class="row">
  <div>div</div>
  <div>div</div>
  <div>div</div>
</div>

<h3>Three unequal columns</h3>
<p>Get three columns of various widths, with the center column being twice as wide as the other two.</p>

<div class="row center-focus">
  <div>div</div>
  <div class="focus">.focus</div>
  <div>div</div>
</div>

<h3>Two columns</h3>
<p>Get two columns, with the first column being twice as wide as the second.</p>

<div class="row">
  <div class="focus">.focus</div>
  <div>div</div>
</div>

<h3>Two columns with nested columns</h3>
<p>Nesting is easy—just put a row within an existing row. This gives you two columns with another two (of equal width) within the larger column.</p>
<p>At mobile device sizes, these columns and their nested columns will stack.</p>

<div class="row">
  <div class="focus">
    .focus
    <div class="row">
      <div>div</div>
      <div>div</div>
    </div>
  </div>
  <div>div</div>
</div>

              
            
!

CSS

              
                * {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 20px 40px;
  font-family: Avenir, "Helvetica Neue", sans-serif;
}

/* Rows */
.row {
  display: grid;
  grid-auto-flow: column;
  margin-bottom: 30px;
}

.row .row {
  margin-bottom: 0;
}

.row > * {
  padding: 15px;
  background-color: rgba(86,61,124,0.15);
  border: 1px solid rgba(86,61,124,0.2);
}

.focus {
  grid-column: span 2;
  background-color: rgba(150,61,124,0.15);
}

/* Mobile */
@media (max-width: 600px) {
  .row .row {
    margin: 15px -15px -15px;
  }
  
  .row {
    grid-auto-flow: row;
  }
  
  .focus {
    grid-column: auto;
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console