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 class="container" ng-controller="FlexboxCtrl as $ctrl">
  <h2 class="text-center">Wrapper <code>justify-content: <select class="inpu-sm" ng-options="option as option.name for option in $ctrl.justifyOptions track by option.id" ng-model="$ctrl.justifyContent"></select> ;</code></h2>
  <p class="text-center">Try this sample in full view and add at least two more elements for "space-around" and "space-between" differences!</p>
  <ul class="c-blurbs list-unstyled justify-content__{{$ctrl.justifyContent.name}}">
    <li class="c-blurbs__item" ng-repeat="blurb in $ctrl.blurbs track by $index">
      <figure>
        <img class="c-blurbs__item__img" src="http://old.oguzgelal.com/frontend/assets/img/toptal_icon.png" alt="Blurb subject">
        <figcaption>
          <h3>Some blurb element</h3>
          <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.</p>
          <button class="btn btn-danger btn-block" ng-click="$ctrl.removeElement($index)"><i class="glyphicon glyphicon-trash"></i></button>
        </figcaption>
      </figure>
    </li>
  </ul>
  <button class="btn btn-success btn-block" ng-click="$ctrl.addElement()"><i class="glyphicon glyphicon-plus"></i></button>
</section>
            
          
!
            
              $blue: #3863A0;
$green: #3DBE8B;

.c-blurbs{
  display: flex;
  flex-wrap: wrap;
  text-align: center;
  
  &.justify-content{
    &__flex-start{justify-content: flex-start;}
    &__flex-end{justify-content: flex-end;}
    &__center{justify-content: center;}
    &__space-around{justify-content: space-around;}
    &__space-between{justify-content: space-between;}
  }
  
  &__item{
    flex-grow: 0;
    flex-shrink: 0;
    flex-basis: auto;
    
    width: calc(33.33% - 60px); // Due to issues with IE and box-sizing: border-box this is the best workaround
    padding: 30px;
    box-sizing: content-box;
    position: relative;
    
    &__img{
      max-width: 50px;
    }
    
    figure{
      margin: 0;
    }
    
    .btn-danger{
      position: absolute;
      left: 0;
      right: 0;
      top: 0;
      bottom: 0;
      opacity: 0;
      transition: all 200ms;
    }
    
    &:hover{
      .btn-danger{
        opacity: 1;
      } 
    }
    
    @media only screen and (max-width: 1023px) and (min-width: 641px){
      width: calc(50% - 60px);
    }
    
    @media only screen and (max-width: 640px){
      width: calc(100% - 60px);
    }
  }
}
            
          
!
            
              (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 = [];

  // Flexbox controller (hoists)
  function FlexboxCtrl(){
    var $ctrl = this;
    
    $ctrl.justifyOptions = [
      {id: 1, name: "flex-start"},
      {id: 2, name: "flex-end"},
      {id: 3, name: "center"},
      {id: 4, name: "space-around"},
      {id: 5, name: "space-between"}
    ];
    
    $ctrl.justifyContent = $ctrl.justifyOptions[0];
    
    $ctrl.blurbs = [
      '','',''
    ]    
    
    $ctrl.removeElement = removeElement;
    $ctrl.addElement = addElement;
    
    function removeElement(index){
      $ctrl.blurbs.splice(index, 1);
    }
    
    function addElement(){
      $ctrl.blurbs.push('');
    }
  }
  
  // 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