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

              
                  <div class="grid">
    <header><h1>This is CSS Grid Layout!</h1></header>

    <div class="content">

      <p>Grid Layout gives us a method of creating structures that are not unlike using “tables for layout”. However, being described in CSS and not in HTML they allow us to create layouts that can be redefined using Media Queries and adapt to different contexts.</p>

      <p>Grid Layout lets us properly separate the order of elements in the source from their visual presentation. As a designer this means you are free to change the location of page elements as is best for your layout at different breakpoints and not need to compromise a sensible structred document for your responsive design.</p>

      <p>It’s very easy to make grid adapt to the available space. With each element having an area on the grid, things are not in risk of overlapping due to text size change, more content than expected or small viewports.</p>

      <p>Unlike with an HTML table-based layout, you can layer items on the grid. So one item can overlap another if required.</p>


    </div>

    <nav>
      <ul>
        <li><a href="http://www.w3.org/TR/css-grid-1">CSS Grid Spec</a></li>
        <li><a href="http://drafts.csswg.org/css-grid/">CSS Grid latest Editor's Draft</a></li>
        <li><a href="http://gridbyexample.com">Grid by Example</a></li>
        <li><a href="https://igalia.github.io/css-grid-layout/">Examples from Igalia</a></li>
      </ul>

    </nav>

    <aside>
      <p>CSS Grid Layout is coming soon! Take a look at the examples using <a href="http://gridbyexample.com/browsers/">a supporting browser</a>.</p>
    </aside>

    <footer>
      <p>Talk to me about Grid on <a href="https://twitter.com/rachelandrew">Twitter</a>!</p>
    </footer>
  </div>

              
            
!

CSS

              
                    .grid > * {
      padding: 10px;
    }

    .grid {
      margin: 20px auto 0 auto;
      max-width: 960px;
      display: grid;
      grid-template-columns: repeat(5, 1fr);
      grid-template-rows: repeat(3, auto);
    }

    header {
      background-color: #efefef;
      grid-column: 1 / 6;
      grid-row: 1;
    }

    .content {
      grid-column: 2 / 5;
      grid-row: 2;
    }

    nav { 
      grid-column: 1 / 2;
      grid-row: 2;
      background-color: #ccc;
    }

    aside {
      grid-column: 5;
      grid-row: 2;
      background-color: #ccc;
    }

    footer {
      grid-column: 1 / 6;
      grid-row: 3;
      background-color: #efefef;
    }
              
            
!

JS

              
                
              
            
!
999px

Console