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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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="headline_area">
  <h1 class="headline">Flex Grid (without extra markup)</h1>
</div>

<ul class="flex_grid cols_2">
  <li>
    <div class="demo_block">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In molestie ut risus ut accumsan.</div>
  </li>
  <li>
    <div class="demo_block">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In molestie ut risus ut accumsan.</div>
  </li>
  <li>
    <div class="demo_block">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In molestie ut risus ut accumsan.</div>
  </li>
</ul>

<ul class="flex_grid cols_3">
  <li>
    <div class="demo_block">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In molestie ut risus ut accumsan.</div>
  </li>
  <li>
    <div class="demo_block">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In molestie ut risus ut accumsan.</div>
  </li>
  <li>
    <div class="demo_block">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In molestie ut risus ut accumsan. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In molestie ut risus ut accumsan.</div>
  </li>
  <li>
    <div class="demo_block">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In molestie ut risus ut accumsan.</div>
  </li>
  <li>
    <div class="demo_block">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In molestie ut risus ut accumsan.</div>
  </li>
  <li>
    <div class="demo_block">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In molestie ut risus ut accumsan.</div>
  </li>
  <li>
    <div class="demo_block">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In molestie ut risus ut accumsan.</div>
  </li>
  <li>
    <div class="demo_block">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In molestie ut risus ut accumsan.</div>
  </li>
</ul>

<ul class="flex_grid cols_4">
  <li>
    <div class="demo_block">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In molestie ut risus ut accumsan.</div>
  </li>
  <li>
    <div class="demo_block">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In molestie ut risus ut accumsan.</div>
  </li>
  <li>
    <div class="demo_block">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In molestie ut risus ut accumsan.</div>
  </li>
  <li>
    <div class="demo_block">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In molestie ut risus ut accumsan.</div>
  </li>
  <li>
    <div class="demo_block">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In molestie ut risus ut accumsan.</div>
  </li>
  <li>
    <div class="demo_block">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In molestie ut risus ut accumsan.</div>
  </li>
</ul>

<ul class="flex_grid cols_5">
  <li>
    <div class="demo_block">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In molestie ut risus ut accumsan.</div>
  </li>
  <li>
    <div class="demo_block">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In molestie ut risus ut accumsan.</div>
  </li>
  <li>
    <div class="demo_block">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In molestie ut risus ut accumsan.</div>
  </li>
  <li>
    <div class="demo_block">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In molestie ut risus ut accumsan.</div>
  </li>
  <li>
    <div class="demo_block">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In molestie ut risus ut accumsan.</div>
  </li>
  <li>
    <div class="demo_block">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In molestie ut risus ut accumsan.</div>
  </li>
  <li>
    <div class="demo_block">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In molestie ut risus ut accumsan.</div>
  </li>
</ul>

<ul class="flex_grid cols_6">
  <li>
    <div class="demo_block">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In molestie ut risus ut accumsan.</div>
  </li>
  <li>
    <div class="demo_block">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In molestie ut risus ut accumsan.</div>
  </li>
  <li>
    <div class="demo_block">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In molestie ut risus ut accumsan.</div>
  </li>
  <li>
    <div class="demo_block">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In molestie ut risus ut accumsan.</div>
  </li>
  <li>
    <div class="demo_block">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In molestie ut risus ut accumsan.</div>
  </li>
  <li>
    <div class="demo_block">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In molestie ut risus ut accumsan.</div>
  </li>
  <li>
    <div class="demo_block">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In molestie ut risus ut accumsan.</div>
  </li>
  <li>
    <div class="demo_block">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In molestie ut risus ut accumsan.</div>
  </li>
</ul>
              
            
!

CSS

              
                /*---:[ Non Essential aesthetic CSS for Demo ]:---*/
html {
  -webkit-box-sizing: border-box; 
  -moz-box-sizing: border-box; 
  box-sizing: border-box;
}
*, *:before, *:after {
  box-sizing: inherit;
}
.headline_area {
  background-color: #ff2222;
  margin: 0 40px;
  .headline {
    text-align: center;
    color: #fff;
    padding: 16px;
  }
}
.flex_grid {
  border-bottom: 1px solid #f2f2f2;
  margin-bottom: 26px;
  padding-bottom: 26px;
  padding-right: 40px;
  margin-left: 0.5em;
  > li {
    margin-bottom: 16px;
    .demo_block {
      color: #999;
      padding: 26px;
      flex: 1 1 auto;
      height: 100%;
      background-color: #f2f2f2;
      margin-right: 1em;
    }
  }
}

/*---:[ Core CSS required ]:---*/
.flex_grid {
  display: flex;
  list-style: none;
  flex-flow: row wrap;
  align-content: flex-start;
  > li {
    display: flex;    
    justify-content: space-between;
    flex-flow: column nowrap;
    width: 100%;
  }
}

@media all and (min-width: 768px) {
  .flex_grid > li {
    width: 50%;
  }
}

@media all and (min-width: 1224px) {
  .flex_grid {
    &.cols_2 {
      > li {
        width: 50%;	
      }
    }
    &.cols_3 {
      > li {
        width: 33.333%;
      }
    }
    &.cols_4 {
      > li {
        width: 25%;
      }
    }
    &.cols_5 {
      > li {
        width: 20%;
      }
    }
    &.cols_6 {
      > li {
        width: 16.666%;
      }
    }
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console