cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Generate a Crapload of Flexbox

A Pen By Captain Anonymous

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 class="controls">
  <input type="range" id="amount" />

<div id="flexbox-land">
              .controls {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 200px;
  padding: 20px;
  background: rgba(0,0,0,0.5);
input {
  width: 100%;

.flexer {
  display: -webkit-box;
  display: -moz-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex; 
  width: 100%;
  list-style: none;
  padding: 0;

.flexer > li {
  padding: 20px;
  margin: 0;
  -webkit-box-flex: 1;
  -moz-box-flex: 1; 
  width: 20%;
  -webkit-flex: 1;
  -ms-flex: 1;
  flex: 1;
              function removeAll() {

var dummyText = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.";
var dummyTextArray = dummyText.split(" ");

var template = _.template(
  "<ul class='flexer'>" + 
  "<li style='width: <%= width %>%; background: <%= background1 %>'>" + 
       "<%= content %>" + 
    "</li>" +

$("#amount").on("change", function() {
  var num = $(this).val()/5, i;
  var tempString = '';
  var newTempString = '';
  for (i = 0; i < num; i++) {
    var strLength = (Math.random()*80)+1;
    var content = "";
    for (x = 0; x < strLength; x++) {
       content += dummyTextArray[x] + " ";
    newTempString = template({
      "width": Math.floor((Math.random()*40)+20),
      "background1": '#'+Math.floor(Math.random()*16777215).toString(16),
      "background2": '#'+Math.floor(Math.random()*16777215).toString(16),
      "content" : tempString
    tempString = newTempString;
    // probably should concat all the strings then append just once.    
Loading ..................