Pen Settings



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


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


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.


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.


                <section data-ng-controller="FlexboxCtrl as $ctrl" class="container-fluid">
  <header class="m-header text-center">
    <h2>Children - <code>flex-basis</code></h2>
    <p class="h3">Edit or remove the elements by clicking them or add a few more bellow the wrapper</p>
    <p>Remember to use the same values you would use for <code>width</code> property.</p>
  <!-- Wrapper -->
  <div class="col-md-offset-3 col-md-6 col-xs-12">   
    <ul class="sample-wrapper list-unstyled">
      <li ng-repeat="elem in $ctrl.elements track by $index"
           class="element u-clickable" 
                  -webkit-flex-grow: {{elem.grow}};
                  -ms-flex-grow: {{elem.grow}};
                  flex-grow: {{elem.grow}};
                  -webkit-flex-shrink: {{elem.shrink}};
                  -ms-flex-shrink: {{elem.shrink}};
                  flex-shrink: {{elem.shrink}};
                  -webkit-flex-basis: {{elem.basis}};
                  -ms-flex-basis: {{elem.basis}};
                  flex-basis: {{elem.basis}};
                  height: {{elem.height}};
                  -webkit-order: {{elem.order}};
                  -ms-order: {{elem.order}};
                  order: {{elem.order}};
                  -webkit-align-self: {{}};
                  -ms-align-self: {{}};
                  align-self: {{}};
    <button class="btn btn-success btn-block" ng-click="$ctrl.addElement()" ng-show="$ctrl.elements.length < 10 || !!$ctrl.infiniteItems"><i class="glyphicon glyphicon-plus"></i></button>
    <div ng-show="$ctrl.elements.length >= 10 || !!$ctrl.infiniteItems" class="alert alert-warning alert-dismissible" role="alert">
      <p><strong>Ups!</strong> You have reached the limit of 10 elements.</p>
      <p ng-click="$ctrl.infiniteItems = !$ctrl.infiniteItems" class="u-clickable">
        <span class="u-checkbox" ng-class="{'active': $ctrl.infiniteItems}">
          <i class="fa fa-check"></i>
        I don't care I want to add more


<script type="text/ng-template" id="popover.html">
  <div class="form-group">
      <input type="text" class="form-control inpu-sm" ng-model="elem.basis">
    <button class="btn btn-danger btn-block" ng-click="$ctrl.removeElement($index)"><i class="glyphicon glyphicon-trash"></i></button>


                $blue: #3863A0;
$green: #3DBE8B;

 * Refactors
.rzslider .rz-pointer {
  background-color: $blue;
    outline: none;
    box-shadow: none;
    background-color: $green;
      background-color: $blue;
.rzslider .rz-selection {
  background-color: darken($green, 10%);

.btn-primary {
  background-color: $green!important;
  border-color: darken($green, 10%)!important;
    background-color: $blue!important;
    border-color: darken($blue, 10%)!important;

.btn-success {
  background-color: $green!important;
  border-color: darken($green, 10%)!important;
  margin-bottom: 20px;

      padding: 10px;
        display: block;

 * Utilities
  cursor: pointer;
  user-select: none;
  display: inline-block;
  width: 20px;
  height: 20px;
  border: solid 1px #a9a9a9;
  background-color: white;
  border-radius: 2px;
  text-align: center;
  margin-right: 10px;
    opacity: 0;
    color: $green;
    transition: all 400ms linear;
      opacity: 1;

 * Modules
  margin-bottom: 30px;
    border-bottom: solid 1px lightgray;
    padding-bottom: 20px;

  border: dashed 4px #A9A9A9;
  transition: all 400ms linear;
  counter-reset: elements;
  margin-bottom: 20px;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  .element {
    color: white;
    text-align: center;
      box-shadow: 0 0 0px 4px white, 0 0 0px 8px orange;
      outline: none;
    @for $i from 1 to 11{
        margin: 15px;
        @if $i < 6 {
          $darken: $i * 5% - 5;
          background: darken($blue, $darken);
        } @else {
          $j: $i - 5;
          $darken: $j * 5% - 5;
          background: darken($green, $darken);
      counter-increment: elements;
      content: counter(elements);
      margin: 5px;


  'use strict';
  // Define app and elements
  angular.module("flexbox", ['ngSanitize','ui.bootstrap'])
    // Flexbox controller (called from the component)
    .controller('FlexboxCtrl', FlexboxCtrl);

  // Dependencies injections
  FlexboxCtrl.$inject = ['$uibModal', '$document'];

  // Flexbox controller (hoists)
  function FlexboxCtrl($uibModal, $document){
    var $ctrl = this,
        Element = El;
    $ctrl.minHeight = 707;
    $ctrl.maxWidth = 1920;
    $ctrl.infiniteItems = false;
     * Wrapper config
    // Display
    $ctrl.display = 'flex';    
    // Direction
    $ctrl.direction = 'row';    
    // Wrap
    $ctrl.wrap = 'nowrap';
    // Justify content
    $ctrl.justifyContent = 'flex-start';
    // Align items
    $ctrl.alignItems = 'stretch';
    // Align content
    $ctrl.alignContent = 'stretch';
     * Wrapper children (elements)
    $ctrl.popover = {
      templateUrl: 'popover.html',
      title: 'Element config'
    $ctrl.elements = [
      new Element(),
      new Element(),
      new Element()     
    $ctrl.removeElement = removeElement;
    $ctrl.addElement = addElement;
    $ctrl.editElement = editElement;
    function El (){
      this.alignOptions = [
        {id: 0, name: "none"},
        {id: 1, name: "flex-start"},
        {id: 2, name: "flex-end"},
        {id: 3, name: "center"},
        {id: 4, name: "stretch"},
        {id: 5, name: "baseline"}
      this.grow = 0;
      this.shrink = 1;
      this.basis = '100px';
      this.height = 'auto';
      this.order = 0;        
      this.alignSelf = this.alignOptions[0];
    function removeElement(index){
      $ctrl.elements.splice(index, 1);
    function addElement(){
      $ctrl.elements.push(new Element());
    function editElement(el, index){      
        animation: true,
        templateUrl: 'modal.html',
        size: 'sm',
        controllerAs: '$ctrl',
        controller: function(){
  // Run app
  angular.bootstrap(document, ['flexbox']);