css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              <section data-ng-controller="FlexboxCtrl as $ctrl" class="container-fluid">
  <header class="m-header text-center">
    <h2>Children - <code>align-self</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">
    <p>By default I've set <code>align-items: center;</code>. You can rewrite the behaviour individually item by item</p>
    <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">
      <select class="form-control inpu-sm" ng-options="option as option.name for option in elem.alignOptions track by option.id" ng-model="elem.alignSelf"></select>
    <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;
  align-items: center;
  min-height: 400px;
  .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']);

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................