<h2>Defining the Basis for Growing<br>Using Column Direction: <code>flex-basis</code></h2>
  <div class="btns">
    <label for="flexbasis">Increase the <code>flex-basis</code> value for flex item #1:<br><input type="number" value="0" min="0" max="400" step="25" id="flexbasis"></label>
    <div class="container">
      <div class="item extra">1</div>
      <div class="item">2</div>
      <div class="item">3</div>
  <div class="dir">
    <label for="column">column <input type="radio" value="column" name="direction" id="column" checked></label>
    <label for="column-reverse">column-reverse <input type="radio" value="column-reverse" name="direction" id="column-reverse"></label>
body {
  font-family: Arial, sans-serif;
  font-size: 1.3em;
  padding: 0 2em 3em;
  line-height: 1.4;

main {
  max-width: 800px;
  margin: 0 auto;

h2 {
  margin-top: 14px;
  text-align: center;

code {
  font-family: Consolas, monospace;
  background: #ccc;
  padding: 1px 3px;

.btns {
  text-align: center;

.btns input {
  width: 75px;
  display: block;
  margin: 12px auto 0;

.dir {
  text-align: center;

label {
  margin-right: 1.3em;
  padding: 8px;

.container {
  max-height: 600px;
  border: solid 2px;
  margin-bottom: 1em;
  background: #b2d5ff;
  display: flex;
  flex-direction: column;

.column {
  flex-direction: column;

.column-reverse {
  flex-direction: column-reverse;

.item {
  background: #007ed3;
  border: solid 2px #305077;
  margin: 5px;
  text-align: center;
  font-size: 3em;
  color: white;
  font-weight: bold;
  flex-grow: 1;
  flex-shrink: 1;
  flex-basis: auto;

.extra {
  flex-basis: content;
let input = document.querySelector('.btns').querySelector('input'),
    dirs = document.querySelector('.dir').querySelectorAll('input'),
    container = document.querySelector('.container'),
    flexitem = document.querySelector('.extra');

input.addEventListener('input', function() {
  flexitem.style.flexBasis = this.value + 'px';
}, false);

for (i of dirs) {
  (function(i) {
    i.addEventListener('click', function() {
      clearClasses(container, dirs);
    }, false);

function clearClasses (el, cl) {
  for (i of cl) {

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.