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

              
                <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