Pen Settings

HTML

CSS

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.

+ 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

              
                <section class="container">
<div class="article">This is a demonstration of a 2-column grid with repeating rows using CSS Grid, with a fallback using Flexbox.</div>
<div class="article">Lorem ipsum dolor sit amet consectetur adipisicing elit. Nesciunt repellendus consequatur, quibusdam quidem, fugiat labore ea nostrum doloremque sint reiciendis eum impedit?</div>
<div class="article">Lorem ipsum dolor sit amet consectetur.</div>
<div class="article">Lorem ipsum dolor, sit amet consectetur adipisicing elit. Quaerat libero itaque consequatur veniam doloremque, eum sit molestias similique, quibusdam eveniet iusto, nihil laboriosam expedita neque velit? Vitae eligendi qui obcaecati unde et autem, mollitia labore expedita dignissimos porro omnis iusto laudantium illum cumque aperiam ducimus quisquam distinctio, minima perferendis excepturi, a eius voluptas sequi! Delectus at voluptas sapiente eum sit ad eius eaque sunt consectetur nulla. Molestiae nobis iure ratione. Vero architecto velit molestias iure illum, facilis amet placeat officia harum temporibus fugiat sequi sed corporis minus eligendi cum reiciendis ex neque accusamus quam? Temporibus consequuntur delectus, sint dolores fuga dolor obcaecati autem omnis voluptatum officiis repudiandae incidunt similique beatae aperiam corporis ipsa aut velit iste libero harum fugit adipisci.</div>
<div class="article">Lorem ipsum dolor sit amet consectetur adipisicing elit. Eos asperiores laborum earum quo sit voluptates mollitia eum. Labore beatae possimus debitis necessitatibus laudantium?</div>
<div class="article">Lorem ipsum dolor sit amet consectetur adipisicing elit. Atque nulla porro accusamus iusto debitis mollitia ab vel placeat pariatur, ullam blanditiis magnam dolores, error consequuntur et temporibus illo quasi aperiam enim voluptatibus ipsam nam consectetur. Iure eaque eum placeat dicta laudantium at perspiciatis.</div>
</section>
              
            
!

CSS

              
                @media(min-width: 768px) {
  .container {
    display: flex;
    flex-wrap: wrap;
    margin-left: -15px;
    margin-right: -15px;

    > * {
      flex: 1;
      flex-basis: 46%;
      margin: 15px;
    }
  }
}
@media(min-width: 1200px) {
  .container {

    > * {
      flex-basis: 46%;
    }
  }
} 
// flex is 22 lines

// the grid stuff
@supports (display: grid) {

  @media (min-width: 768px) {
    .container {
      display: grid;
      grid-template-columns: repeat(2, 50fr);
      grid-gap: 15px;
      
      > * {
        margin: 0;
      }
    }
  }
} 
// grid is 11 lines (without the @supports, which is there for the fallbacks' benefit)

// general styles
.article {
  font-family: sans-serif;
  color: white;
  padding: 20px;
  background: gray;
  border: lightgray;
  border-radius: 5px;
}
              
            
!

JS

              
                
              
            
!
999px

Console