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

              
                <h1>Test regular flexbox containers</h1>

<p>
  Goal is to get a flexbox with each item having the same width,
  just like the example bellow.
</p>

<div>
  <span class="btn-group">
    <span class="btn">Use Cash</span>
    <span class="btn">Pay in Points</span>
  </span>
</div>

<p> 
  What can make this break like the example bellow?
</p>

<div>
  <span class="btn-group">
    <span class="btn no-wrap">Use Cash</span>
    <span class="btn no-wrap">Pay in Points</span>
  </span>
</div>

<p>
  When the content inside the flex item has some constraints on
  size, such as a <tt>nowrap</tt> configuration, then
  boxes in the flex container won't be equals width anymore.
</p>

<div>
  <span class="btn-group">
    <span class="btn some-width">Use Cash</span>
    <span class="btn">Pay in Points</span>
  </span>
</div>

<p>
  So, if you have an issue with  flex container that do not
  properly spread in regular parts, this might be because
  one element has a width property or some wrapping constraints.
<p>
              
            
!

CSS

              
                .btn-group {
  // Layout
  
  display: inline-flex;
  align-items: center;
  
  .btn {
    flex: 1 1 0;
  }
  
  // Border
  
  border: 2px solid #666;
  border-radius: 4px;
  
  .btn {
    border-left: 1px solid #888;
    
    &:first-child { 
      border-left-color: transparent;
    }
  }
  
  // Content layout
  
  .btn {
    padding: 4px;
    text-align: center;
  }
}


.btn.no-wrap {
  white-space: nowrap;
}

.btn.some-width {
  min-width: 8em;
}

              
            
!

JS

              
                
              
            
!
999px

Console