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.

            
              <div data-ng-controller="FlexboxCtrl as $ctrl" class="container">
  <h2>Wrapper <code>display: <span class="pre" data-ng-bind="$ctrl.class.text"></span>;</code></h2>
  <div class="sample-wrapper {{$ctrl.class.class}}">
    <div></div>
    <div></div>
    <div></div>
    <div></div>
  </div>
</div>
            
          
!
            
              $blue: #3863A0;
$green: #3DBE8B;
$props: 'inherit' 'flex' 'inline-flex';
h2{
  text-align: left;
  margin-bottom: 30px;
}
.container{
  text-align: right;
}
.sample-wrapper{
  border: dashed 4px #A9A9A9;
  max-width: 700px;
  min-height: 400px;
  text-align: center;
  counter-reset: elements;
  color: white;
  transition: all 400ms linear;
  
  &.inline-flex{
    position: relative;
    &:before{
      content: "text-align: right pushes the inline-flex wrapper just like if were inline-block";
      right:10px;
      position: absolute;
      bottom: 10px;
      left: 20px;
      color: black;
      font-size: 1.8rem;
      display: block; 
    }
  }
  
  @each $val in $props {
    &.#{$val}{
      display: #{$val};
    }
  }
  
  > div {
    text-align: center;
    
    @for $i from 1 to 11{
      &:nth-of-type(#{$i}){
        height: 50px;    
        line-height: 50px; 
        
        margin: 15px;
        @if $i < 6 {
          $darken: $i * 5% - 5;
          background: darken($blue, $darken);
          width: (300px * ($i * 0.2));
        } @else {
          $j: $i - 5;
          $darken: $j * 5% - 5;
          background: darken($green, $darken);
          width: (300px * ($j * 0.2));
        }
      }

    }
    &:before{
      counter-increment: elements;
      content: counter(elements);
    }
  }
}
            
          
!
            
              (function(angular){
  'use strict';
  
  // Define app and elements
  angular.module("flexbox", ['ngSanitize'])
    // Flexbox controller (called from the component)
    .controller('FlexboxCtrl', FlexboxCtrl);

  // Dependencies injections
  FlexboxCtrl.$inject = ['$interval'];

  // Flexbox controller (hoists)
  function FlexboxCtrl($interval){
    var $ctrl = this,
        index = 0,
        speed = 4000,
        classes = [
          {text: 'inherit', class: 'inherit'},          
          {text: 'flex', class: 'flex'},          
          {text: 'inline-flex', class: 'inline-flex'}
        ],
        length = classes.length - 1;
    
    $ctrl.class = classes[index];
    
    $interval(timer, speed);
    
    function timer(){
      index = (length === index) ? 0 : index + 1;
      $ctrl.class = classes[index];
    }
  }
  
  // Run app
  angular.bootstrap(document, ['flexbox']);
})(angular)



            
          
!
999px
Close

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.

Go PRO

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

Console