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="container">
  <h1>Flexbox</h1>

  <h2>No Flex</h2>

  <div style="background-color: gray;">

    <div class="box yellow">
      1
    </div>

    <div class="box orange">
      2
    </div>

    <div class="box red">
      3
    </div>

    <div class="box purple">
      4
    </div>

    <div class="box blue">
      5
    </div>

    <div class="box light-blue">
      6
    </div>

  </div>

  <h2>Flex</h2>

  <div style="background-color: gray;">

    <div class="box yellow">
      1
    </div>

    <div class="box orange">
      2
    </div>

    <div class="box red">
      3
    </div>

    <div class="box purple">
      4
    </div>

    <div class="box blue">
      5
    </div>

    <div class="box light-blue">
      6
    </div>

  </div>


  <h2>Flex With More Content</h2>

  <p>When flexing, the flex items will default to content size</p>

  <div style="background-color: gray;">

    <div class="box yellow">
      1 - This is more content than before.
    </div>

    <div class="box orange">
      2 - This is more content than before.
    </div>

    <div class="box red">
      3 - This is more content than before.
    </div>

    <div class="box purple">
      4 - This is more content than before.
    </div>

    <div class="box blue">
      5 - This is more content than before.
    </div>

    <div class="box light-blue">
      6 - This is more content than before.
    </div>

  </div>

  <h2>Flex Direction!</h2>

  <p>You can shift things back into a vertical orientation.</p>

  <div style="display: flex; background-color: gray;">

    <div class="box yellow">
      1 - This is more content than before.
    </div>

    <div class="box orange">
      2 - This is more content than before.
    </div>

    <div class="box red">
      3 - This is more content than before.
    </div>

    <div class="box purple">
      4 - This is more content than before.
    </div>

    <div class="box blue">
      5 - This is more content than before.
    </div>

    <div class="box light-blue">
      6 - This is more content than before.
    </div>

  </div>


  <h2>Sizing with Flexbox</h2>

  <p>You can use the usual methods of sizing things, like height, width, margin, and padding.</p>

  <div style="display: flex; background-color: gray;">

    <div class="box yellow" style="">
      1 - This is more content than before.
    </div>

    <div class="box orange" style="">
      2 - This is more content than before.
    </div>

    <div class="box red" style="">
      3 - This is more content than before.
    </div>

    <div class="box purple" style="">
      4 - This is more content than before.
    </div>

    <div class="box blue" style="">
      5 - This is more content than before.
    </div>

    <div class="box light-blue" style="">
      6 - This is more content than before.
    </div>

  </div>


</div>
              
            
!

CSS

              
                body {
    margin: 0;
}

header {
    background-color: #EEE;
    margin-top: 0;
    padding: 10px;
}

.container {
    margin: 0 auto;
    max-width: 960px;
}

.yellow {
    background-color: yellow;
}

.orange {
    background-color: orange;
}

.red {
    background-color: red;
}

.purple {
    background-color: purple;
}

.blue {
    background-color: blue;
}

.light-blue {
    background-color: rgba(29, 178, 212, 1.0);
}

              
            
!

JS

              
                
              
            
!
999px

Console