cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-personicon-teamoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation


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.

              <section data-ng-controller="FlexboxCtrl as $ctrl" class="container-fluid">
  <header class="m-header text-center">
    <h2>Children - <code>order</code></h2>
    <p class="h3">Edit or remove the elements by clicking them or add a few more bellow the wrapper</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: {{elem.alignSelf.name}};
                  -ms-align-self: {{elem.alignSelf.name}};
                  align-self: {{elem.alignSelf.name}};
    <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="number" class="form-control inpu-sm" ng-model="elem.order">
    <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']);


Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.


Loading ..................