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

              
                <h1>2 col distribution</h1>
<ul class="flex-2-cols">
    <li><h1>1</h1></li>
    <li><h1>2</h1>
        Lorem ipsum dolor sit amet, consectetur
        adipisicing elit. Commodi corporis eligendi
        enim excepturi laboriosam nesciunt odlor sit
        amet, consectetur adipisicing elit. Commodi
        corporis eligendi enim excepturi laboriosam
        nesciunt odlor sit amectetur adipisicing elit.
        Commodi corporis eligendi enim excepturi lab
        oriosam nesciunt odit quae qui quibusdam reru
        m. Aspernatur atque dicta dolores iure
    </li>
    <li><h1>3</h1></li>
    <li><h1>4</h1></li>
    <li><h1>5</h1>
        Lorem ipsum dolor sit amet, consectetur adipi
        sicing elit. Commodi corporis eligendi enim e
        xcepturi laboriosam nesciunt odit quae qui q
        uib consectetur adipisicing elit. Commodi co
        rporis eligendi enim excepturi laboriosam ne
        sciunt odit quae qui quib consectetur adipis
        icing elit. Commodi corporis eligendi enim exc
        epturi laboriosam nesciunt odit quae qui quibu
        sdam rerum. Aspernatur atque dicta dolores iur
        e laudantium nulla omnis quam quisquam.
    </li>
    <li><h1>6</h1>
        Lorem ipsum dolor sit amet, consectetur adipisicin
        g elit. Commodi corporis eligendi enim excepturi l
        aboriosam nesciunt odit quae qui quibusdam rerum.
        Aspernatur atque dicta dolores iure
    </li>
    <li><h1>7</h1>
        Lorem ipsum dolor sit amet, consectetur adipisicin
        g elit. Commodi corporis eligendi enim excepturi l
        aboriosam nesciunt odit quae qui quibusdam rerum.
        Aspernatur atque dicta dolores iure laudantium nul
        la omnis quam quisquam.
    </li>
    <li><h1>8</h1>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Commodi corporis eligendi enim excepturi laboriosam nesciunt odit quae qui quibusdam rerum. Aspernatur atque dicta dolores iure laudantium nulla omnis quam quisquam.
    </li>
</ul>

<h1>5 col distribution</h1>
<ul class="flex-5-cols">
    <li><h1>1</h1></li>
    <li><h1>2</h1>
        Lorem ipsum dolor sit amet, consectetur
        adipisicing elit. Commodi corporis eligendi
        enim excepturi laboriosam nesciunt odlor sit
        amet, consectetur adipisicing elit. Commodi
        corporis eligendi enim excepturi laboriosam
        nesciunt odlor sit amectetur adipisicing elit.
        Commodi corporis eligendi enim excepturi lab
        oriosam nesciunt odit quae qui quibusdam reru
        m. Aspernatur atque dicta dolores iure
    </li>
    <li><h1>3</h1></li>
    <li><h1>4</h1></li>
    <li><h1>5</h1>
        Lorem ipsum dolor sit amet, consectetur adipi
        sicing elit. Commodi corporis eligendi enim e
        xcepturi laboriosam nesciunt odit quae qui q
        uib consectetur adipisicing elit. Commodi co
        rporis eligendi enim excepturi laboriosam ne
        sciunt odit quae qui quib consectetur adipis
        icing elit. Commodi corporis eligendi enim exc
        epturi laboriosam nesciunt odit quae qui quibu
        sdam rerum. Aspernatur atque dicta dolores iur
        e laudantium nulla omnis quam quisquam.
    </li>
    <li><h1>6</h1>
        Lorem ipsum dolor sit amet, consectetur adipisicin
        g elit. Commodi corporis eligendi enim excepturi l
        aboriosam nesciunt odit quae qui quibusdam rerum.
        Aspernatur atque dicta dolores iure
    </li>
    <li><h1>7</h1>
        Lorem ipsum dolor sit amet, consectetur adipisicin
        g elit. Commodi corporis eligendi enim excepturi l
        aboriosam nesciunt odit quae qui quibusdam rerum.
        Aspernatur atque dicta dolores iure laudantium nul
        la omnis quam quisquam.
    </li>
    <li><h1>8</h1>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Commodi corporis eligendi enim excepturi laboriosam nesciunt odit quae qui quibusdam rerum. Aspernatur atque dicta dolores iure laudantium nulla omnis quam quisquam.
    </li>
    <li><h1>9</h1>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Commodi corporis eligendi enim excepturi laboriosam nesciunt odit quae qui quibusdam rerum. Aspernatur atque dicta dolores iure laudantium nulla omnis quam quisquam.
    </li>
    <li><h1>10</h1>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Commodi corporis eligendi enim excepturi laboriosam nesciunt odit quae qui quibusdam rerum. Aspernatur atque dicta dolores iure laudantium nulla omnis quam quisquam.
    </li>
</ul>

<h1>9 col distribution</h1>
<ul class="flex-9-cols">
    <li><h1>1</h1></li>
    <li><h1>2</h1>
        Lorem ipsum dolor sit amet, consectetur
        adipisicing elit. Commodi corporis eligendi
        enim excepturi laboriosam nesciunt odlor sit
        amet, consectetur adipisicing elit. Commodi
        corporis eligendi enim excepturi laboriosam
        nesciunt odlor sit amectetur adipisicing elit.
        Commodi corporis eligendi enim excepturi lab
        oriosam nesciunt odit quae qui quibusdam reru
        m. Aspernatur atque dicta dolores iure
    </li>
    <li><h1>3</h1></li>
    <li><h1>4</h1></li>
    <li><h1>5</h1>
        Lorem ipsum dolor sit amet, consectetur adipi
        sicing elit. Commodi corporis eligendi enim e
        xcepturi laboriosam nesciunt odit quae qui q
        uib consectetur adipisicing elit. Commodi co
        rporis eligendi enim excepturi laboriosam ne
        sciunt odit quae qui quib consectetur adipis
        icing elit. Commodi corporis eligendi enim exc
        epturi laboriosam nesciunt odit quae qui quibu
        sdam rerum. Aspernatur atque dicta dolores iur
        e laudantium nulla omnis quam quisquam.
    </li>
    <li><h1>6</h1>
        Lorem ipsum dolor sit amet, consectetur adipisicin
        g elit. Commodi corporis eligendi enim excepturi l
        aboriosam nesciunt odit quae qui quibusdam rerum.
        Aspernatur atque dicta dolores iure
    </li>
    <li><h1>7</h1>
        Lorem ipsum dolor sit amet, consectetur adipisicin
        g elit. Commodi corporis eligendi enim excepturi l
        aboriosam nesciunt odit quae qui quibusdam rerum.
        Aspernatur atque dicta dolores iure laudantium nul
        la omnis quam quisquam.
    </li>
    <li><h1>8</h1>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Commodi corporis eligendi enim excepturi laboriosam nesciunt odit quae qui quibusdam rerum. Aspernatur atque dicta dolores iure laudantium nulla omnis quam quisquam.
    </li>
</ul>
              
            
!

CSS

              
                @mixin flex-grid($cols, $gutter: 0) {
  display: flex;
  flex-wrap: wrap;

  > * {
    // Reset to prevent external styles break the grid.
    margin-left: 0;
    margin-bottom: 0;
    $item-width: calc((100% / #{$cols}) - #{$gutter} + (#{$gutter} / #{$cols}));
    margin-right: $gutter;
    width: $item-width;
    box-sizing: border-box;

    // We add the gutter for all items except the first row.
    &:nth-child(n+#{$cols + 1}) {
      margin-top: $gutter;
    }

    // When we reach the cols per line, the last
    // col item must not have margin right.
    &:nth-child(#{$cols}n) {
      margin-right: 0;
    }

  }
}

/////////////////////////////////////////
.flex-2-cols {
  @include flex-grid(2, 40px)
}

.flex-5-cols {
  @include flex-grid(5, 20px)
}

.flex-9-cols {
  @include flex-grid(9, 20px)
}



////////////////////////////////
// Just some decoration.
ul {
  margin: 0;
  padding:0;
  list-style: none;
  margin-bottom: 30px;
  background: #dadada;

  li {
    border-bottom: 1px solid yellowgreen;
    padding: 30px;

    &:nth-child(odd) {
      background: #f76914;
    }

    &:nth-child(even) {
      background: #474cff;
    }

    h1 {
      margin: 0;
    }
  }

}
              
            
!

JS

              
                
              
            
!
999px

Console