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

              
                <h2>Flex</h2>
<section class="flex">
  <div class="item">1</div>
  <div class="item">2</div>
  <div class="item">3</div>
</section>

<h2>Flex grow</h2>
<section class="flex">
  <div class="item flex-grow">1</div>
  <div class="item flex-grow">2</div>
  <div class="item flex-grow">3</div>
</section>

<h2>Flex grow 2</h2>
<section class="flex">
  <div class="item">1</div>
  <div class="item flex-grow">2</div>
  <div class="item">3</div>
</section>

<h2>Flex grow 3</h2>
<section class="flex">
  <div class="item flex-grow-2">1</div>
  <div class="item flex-grow">2</div>
  <div class="item flex-grow-2">3</div>
</section>

<h2>Flex wrap</h2>
<section class="flex flex-wrap">
  <div class="item flex-grow">1</div>
  <div class="item flex-grow">2</div>
  <div class="item flex-grow">3</div>
  <div class="item flex-grow" style="width: 100%;">3</div>
</section>

<h2>Flex push</h2>
<section class="flex">
  <div class="item item-50 item-dashed item-left flex-grow">Header</div>
  <div class="item">Action</div>
</section>

<h2>Align items</h2>
<section class="flex align-items">
  <div class="item" style="height: 200px;">Big</div>
  <div class="item">Small</div>
</section>

<h2>Justify content</h2>
<section class="flex justify-content">
  <div class="item">1</div>
  <div class="item">2</div>
</section>

<h2>Direction</h2>
<section class="flex flex-direction-column" style="height: 200px">
  <div class="item">1</div>
  <div class="item flex-grow">2</div>
</section>

<h2>Flex basis</h2>
<section class="flex flex-wrap">
  <div class="item flex-grow flex-shrink flex-basis">1</div>
  <div class="item flex-grow flex-shrink flex-basis">2</div>
  <div class="item flex-grow flex-shrink flex-basis">3</div>
</section>

<h2>Center div</h2>
<section class="item item-50 item-dashed flex align-items justify-content-center" style="height: 200px; width: 200px;">
  <div class="item item-dark">X</div>
</section>
              
            
!

CSS

              
                .flex {
  display: flex;
  gap: 0.5rem;
}

.flex-direction-column {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.flex-shrink {
  flex-shrink: 1;
}

.flex-grow {
  flex-grow: 1;
}

.flex-grow-2 {
  flex-grow: 2;
}

.flex-grow-100 {
  flex-grow: 100;
}

.align-items {
  align-items: center;
}

.justify-content {
  justify-content: space-between;
}

.justify-content-center {
  justify-content: center;
}

.flex-basis {
  flex-basis: 500px;
}

              
            
!

JS

              
                
              
            
!
999px

Console