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.

            
              <header>  
  <h1>Flexbox Playground</h1>
    <a href="http://webdesignerwall.com/tutorials/master-css-flexbox-5-simple-steps" target="_blank">View Tutorial</a>
</header>

<!--Based on the lovely work by Gabi https://codepen.io/enxaneta, forked primarily for presentation, language and CSS adjustments -->
<section class="main" role="main">
  <div class="main-column">
  <h2>Flex Container Properties</h2>
  <!--flex-direction: controls -->  
  <div class="control">
    <h4><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/flex-flow">flex-direction</a>   </h4>
  <div class="radio">
    <input name="flex-direction" type="radio"  class="flex-direction" id="R11" value="row" checked><label for="R11">row:</label>
  <input name="flex-direction"  type="radio" class="flex-direction" id="R12" value="row-reverse"><label for="R12">row-reverse:</label>
  <input name="flex-direction"  type="radio" class="flex-direction" id="R13" value="column"><label for="R13">column:</label>
  <input name="flex-direction"  type="radio" class="flex-direction" id="R14" value="column-reverse"><label for="R14">column-reverse:</label>
  </div>
</div>
<!--flex-direction: row | row-reverse | column | column-reverse;-->    
<div class="flex-container" id="direction">
  <div class="item" data-color="2a80b9">    
    <p>1</p></div>
  <div class="item" data-color="8f44ad">    
    <p>2</p></div>
  <div class="item" data-color="16a086">    
    <p>3</p></div>
  <div class="item" data-color="f1c40f">
    <p>4</p></div>
  <div class="item" data-color="e77e23">
    <p>5</p></div>
</div>

<!-- Flex Wrap: controls -->
  <div class="control">
    <h4><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/flex-flow">flex-wrap</a></h4>
    <div class="radio">
      <input name="flex-wrap" type="radio"  class="flex-wrap" id="R21" value="nowrap" checked><label for="R21">nowrap:</label>
      <input name="flex-wrap" type="radio"  class="flex-wrap" id="R22" value="wrap">   
      <label for="R22">wrap:</label>
      <input name="flex-wrap" type="radio"  class="flex-wrap" id="R23" value="wrap-reverse"><label for="R23">wrap-reverse:</label>
    </div>
  </div>
    
 <!-- flex-wrap: nowrap | wrap | wrap-reverse -->   
<div class="flex-container" id="wrap">
  <div class="item" data-color="2a80b9">  
    <p>1</p></div>
  <div class="item" data-color="8f44ad">
    <p>2</p></div>
  <div class="item" data-color="16a086">
    <p>3</p></div>
  <div class="item" data-color="f1c40f">     
    <p>4</p></div>
  <div class="item" data-color="e77e23">
    <p>5</p></div>
</div>
<!-- Align Items: controls --> 
  <div class="control">
    <h4><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/align-items">align-items</a></h4>
    <div class="radio">
      <input name="flex-align-items" type="radio"  class="flex-align-items" id="R31" value="align-items-start" ><label for="R31">flex-start:</label>
      <input name="flex-align-items" type="radio"  class="flex-align-items" id="R32" value="align-items-end"><label for="R32">flex-end:</label>
      <input name="flex-align-items" type="radio"  class="flex-align-items" id="R33" value="align-items-center"><label for="R33">center:</label>
      <input name="flex-align-items" type="radio"  class="flex-align-items" id="R34" value="align-items-baseline"><label for="R34">baseline:</label>
      <input name="flex-align-items" type="radio"  class="flex-align-items" id="R35" value="align-items-stretch" checked><label for="R35">stretch:</label>
    </div>
 </div>
<!-- align-items: flex-start | flex-end | center | baseline | stretch -->
<div class="flex-container" id="align">
  <div class="item" data-color="2a80b9"> 
    <p>1</p></div>
  <div class="item" data-color="8f44ad">
    <p>2</p></div>
  <div class="item" data-color="16a086">
    <p>3</p></div>
  <div class="item" data-color="f1c40f">
    <p>4</p></div>
  <div class="item" data-color="e77e23">
    <p>5</p></div>
</div>

<!-- Justify Content: controls-->
  <div class="control">
    <h4><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content">justify-content</a>   </h4> 
    <div class="radio">
      <input name="justify-content" type="radio"  class="justify-content" id="R41" value="justify-start" checked >      <label for="R41">flex-start:</label>
      <input name="justify-content" type="radio"  class="justify-content" id="R42" value="justify-end" ><label for="R42">flex-end:</label>
      <input name="justify-content" type="radio"  class="justify-content" id="R43" value="justify-space-between" >    <label for="R43">space-between:</label>
      <input name="justify-content" type="radio"  class="justify-content" id="R44" value="justify-center" ><label for="R44">center:</label>
      <input name="justify-content" type="radio"  class="justify-content" id="R45" value="justify-space-around" ><label for="R45">space-around:</label>
    </div>
  </div>

<!--justify-content: flex-start | flex-end | center | space-between | space-around -->
<div class="flex-container" id="justify">
  <div class="item" data-color="2a80b9"> 
    <p>1</p></div>
  <div class="item" data-color="8f44ad">
    <p>2</p></div>
  <div class="item" data-color="16a086">
    <p>3</p></div>
  <div class="item" data-color="f1c40f">
    <p>4</p></div>
  <div class="item" data-color="e77e23">
    <p>5</p></div>
</div>

<!--Align Content: controls-->
  <div class="control">
    <h4><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/align-content">align-content</a></h4> 
  <div class="radio">
    <input name="align-content" type="radio"  class="align-content" id="R51" value="align-content-start" ><label for="R51">flex-start:</label>
    <input name="align-content" type="radio"  class="align-content" id="R52" value="align-content-end" ><label for="R52">flex-end:</label>
    <input name="align-content" type="radio"  class="align-content" id="R53" value="align-content-center" ><label for="R53">center:</label>
    <input name="align-content" type="radio"  class="align-content" id="R54" value="align-content-space-between" ><label for="R54">space-between:</label>
    <input name="align-content" type="radio"  class="align-content" id="R55" value="align-content-space-around" ><label for="R55">space-around:</label>
    <input name="align-content" type="radio"  class="align-content" id="R56" value="align-content-stretch"  checked>  <label for="R56">stretch:</label>
    </div>
  </div>

<!--align-content: flex-start | flex-end | center | space-between | space-around; -->
<div class="flex-container" id="alignContent">
  <div class="item" data-color="1bbc9d">
    <p>1</p></div>
  <div class="item" data-color="2fcc71">
    <p>2</p></div>
  <div class="item" data-color="3598dc">
    <p>3</p></div>
  <div class="item" data-color="9c59b8">
    <p>4</p></div>
  <div class="item" data-color="34495e">
    <p>5</p></div>
  <div class="item" data-color="16a086">
    <p>6</p></div>
  <div class="item" data-color="27ae61">
    <p>7</p></div>
  <div class="item" data-color="2a80b9">
    <p>8</p></div>
  <div class="item" data-color="8f44ad">
    <p>9</p></div>
  <div class="item" data-color="2d3e50">
    <p>10</p></div>
  <div class="item" data-color="f1c40f">
    <p>11</p></div>
  <div class="item" data-color="e77e23">
    <p>12</p></div>
  <div class="item" data-color="e84c3d">
    <p>13</p></div>
  <div class="item" data-color="ecf0f1">
    <p>14</p></div>
  <div class="item" data-color="96a6a6">
    <p>15</p></div>
  <div class="item" data-color="f49c14">
    <p>16</p></div>
  <div class="item" data-color="d55401">
    <p>17</p></div>
  <div class="item" data-color="c1392b">
    <p>18</p></div>
  <div class="item" data-color="bec3c7">
    <p>19</p></div>
  <div class="item" data-color="808b8d">
    <p>20</p></div>
  </div>
    
</div><!-- End column -->

<!-- Flex Items -->
<div class="main-column">
  <h2>Flex Item Properties</h2>
  
  <!-- Align Self: controls -->
  <div class="control">
    <h4><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/align-self">align-self</a></h4>
  <div class="radio">
    <input name="align-self" type="radio"  class="align-self" id="R61" value="align-self-auto"  checked ><label for="R61">auto:</label>
    <input name="align-self" type="radio"  class="align-self" id="R62" value="align-self-start" ><label for="R62">flex-start:</label>
    <input name="align-self" type="radio"  class="align-self" id="R63" value="align-self-end" ><label for="R63">flex-end:</label>
    <input name="align-self" type="radio"  class="align-self" id="R64" value="align-self-center" ><label for="R64">center:</label>
    <input name="align-self" type="radio"  class="align-self" id="R65" value="align-self-baseline" ><label for="R65">baseline: </label>
    <input name="align-self" type="radio"  class="align-self" id="R66" value="align-self-stretch"><label for="R66">stretch:</label>
   </div>
</div>
  
<!-- align-self: auto | flex-start | flex-end | center | baseline | stretch --> 
<div class="flex-container align-items-center" id="FCI1">
  <div class="item" data-color="f49c14">
    <p>1</p></div>
  <div class="item" data-color="d55401">
    <p>2</p></div>
  <div class="item" data-color="c1392b"  id="alignSelf"><p style="font-size:50px;">3</p></div>
  <div class="item" data-color="bec3c7">
    <p>4</p></div>
  <div class="item" data-color="808b8d">
    <p>5</p></div>
</div>

<!-- Flex Grow: Controls -->
<div class="control">
  <h4><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/flex-grow">flex-grow</a></h4> 
  <div class="radio">
  <label for="R71">Item 1: </label>    
    <input type="number" class="flex-grow" id="R71" min="0" >
  <label for="R72">Item 2: </label>    
    <input type="number" class="flex-grow" id="R72" min="0" >
      <label for="R73">Item 3: </label>
    <input type="number" class="flex-grow" id="R73" min="0" >
      <label for="R74">Item 4: </label>    <input type="number" class="flex-grow" id="R74" min="0" >
    <label for="R75">Item 5: </label>   
  <input type="number" class="flex-grow" id="R75" min="0" >
    </div>
</div>
  
<!-- flex-grow: number -->  
<div class="flex-container align-items-center" id="FCI2">
  <div class="item" id="itemR71" data-color="f49c14"><p>1</p></div>
  <div class="item" id="itemR72" data-color="d55401"><p>2</p></div>
  <div class="item" id="itemR73" data-color="c1392b"><p>3</p></div>
  <div class="item" id="itemR74" data-color="bec3c7"><p>4</p></div>
  <div class="item" id="itemR75" data-color="808b8d"><p>5</p></div>
</div>

<!--Flex Shrink: controls -->
<div class="control">
  <h4><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/flex-shrink">flex-shrink</a>   
  </h4> 
  <div class="radio">
    <label for="R81">Item 1: </label>        <input type="number"  class="flex-shrink" id="R81" min="0" >
    <label for="R82">Item 2: </label>        <input type="number" class="flex-shrink" id="R82" min="0" >
    <label for="R83">Item 3: </label>        <input type="number" class="flex-shrink" id="R83" min="0" >
    <label for="R84">Item 4: </label>        <input type="number" class="flex-shrink" id="R84" min="0" ><label for="R85">Item 5: </label>
    <input type="number" class="flex-shrink" id="R85" min="0">
  </div>
</div>
  
<!-- flex-shrink: number -->  
<div class="flex-container align-items-center" id="FCI3">
  <div class="item" id="itemR81" data-color="f49c14"><p>1</p></div>
  <div class="item" id="itemR82" data-color="d55401"><p>2</p></div>
  <div class="item" id="itemR83" data-color="c1392b"><p>3</p></div>
  <div class="item" id="itemR84" data-color="bec3c7"><p>4</p></div>
  <div class="item" id="itemR85" data-color="808b8d"><p>5</p></div>
</div>

<!-- Flex Basis: controls -->
<div class="control">
  <h4><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/flex">flex</a>
  </h4> 
  <pre>.item { flex: flex-basis | flex-grow | flex-shrink; }</pre>
  <table id="flexBasis">
  <tr><td>Item 1</td><td>Item 2</td></tr>
  <tr><td>
    <input type="number" class="flex-basis" id="B1" min="0" value="50" ><label for="B1">flex-basis %</label></td><td><input type="number" class="flex-basis" id="B2" min="0" value="50" ><label for="B2">flex-basis %</label>
  </td></tr>
  <tr><td>
    <input type="number" class="flex-basis-grow" id="G1" min="0" value="0" >
    <label for="G1">flex-grow</label>
  </td><td>
    <input type="number" class="flex-basis-grow" id="G2" min="0" value="0" ><label for="G2">flex-grow</label></td></tr>
  <tr><td>
    <input type="number" class="flex-basis-shrink" id="S1" min="0" value="0" >
    <label for="S1">flex-shrink</label>
    </td>
    <td>
      <input type="number" class="flex-basis-shrink" id="S2" min="0" value="0" >
      <label for="S2">flex-shrink</label>
  </td></tr>
</table>
</div>

<!--flex: flex-grow | flex-shrink | flex-basis -->
<div class="flex-container align-items-center" id="FCI4">
  <div class="item" id="item1" data-color="f49c14"><p>1</p></div>
  <div class="item" id="item2" data-color="d55401"><p>2</p></div>
</div>

<!-- Order: controls -->
<div class="control">
  <h4><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/order">order</a>
  </h4> 
  <div class="radio">
    <label for="R91">Item 1: </label>
      <input type="number" class="flex-order" id="R91" min="0" >
    <label for="R92">Item 2: </label>   
      <input type="number" class="flex-order" id="R92" min="0" >
    <label for="R93">Item 3: </label>   
      <input type="number" class="flex-order" id="R93" min="0" >
    <label for="R94">Item 4: </label>
      <input type="number" class="flex-order" id="R94" min="0" >
    <label for="R95">Item 5: </label>
      <input type="number" class="flex-order" id="R95" min="0" >
  </div>
</div>
  
   <!-- order: <integer>  -->
  <div class="flex-container align-items-center" id="FCI5">
    <div class="item" id="orderR91" data-color="f49c14"><p>1</p></div>
    <div class="item" id="orderR92" data-color="d55401"><p>2</p></div>
    <div class="item" id="orderR93" data-color="c1392b"><p>3</p></div>
    <div class="item" id="orderR94" data-color="bec3c7"><p>4</p></div>
    <div class="item" id="orderR95" data-color="808b8d"><p>5</p></div>
  </div>
  
  </div><!-- End column -->
</section>
            
          
!
            
              /*flex-direction: row | row-reverse | column | column-reverse;*/

.flex-container.row {
  -webkit-flex-direction: row;
  -ms-flex-direction: row;
  flex-direction: row;
}

.flex-container.row-reverse {
  -webkit-flex-direction: row-reverse;
  -ms-flex-direction: row-reverse;
  flex-direction: row-reverse;
}

.flex-container.column {
  -webkit-flex-direction: column;
  -ms-flex-direction: column;
  flex-direction: column;
}

.flex-container.column-reverse {
  -webkit-flex-direction: column;
  -ms-flex-direction: column;
  flex-direction: column-reverse;
}
#direction .item:nth-of-type(3),
#wrap .item:nth-of-type(3)
{
  height: 150px;
}

/*flex-wrap: nowrap | wrap | wrap-reverse;*/

.flex-container.nowrap {
  -webkit-flex-wrap: nowrap;
  -ms-flex-wrap: nowrap;
  flex-wrap: nowrap;
}

.flex-container.wrap {
  -webkit-flex-wrap: wrap;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
}

.flex-container.wrap-reverse {
  -webkit-flex-wrap: wrap-reverse;
  -ms-flex-wrap: wrap-reverse;
  flex-wrap: wrap-reverse;
}


/*align-items: flex-start | flex-end | center | baseline | stretch;*/

.flex-container.align-items-start {
  -webkit-align-items: flex-start;
  -ms-flex-align: start;
  align-items: flex-start;
}

.flex-container.align-items-end {
  -webkit-align-items: flex-end;
  -ms-flex-align: end;
  align-items: flex-end;
}

.flex-container.align-items-center {
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
}

.flex-container.align-items-baseline {
  webkit-align-items: baseline;
  -ms-flex-align: baseline;
  align-items: baseline;
}

.flex-container.align-items-stretch {
  webkit-align-items: stretch;
  -ms-flex-align: stretch;
  align-items: stretch;
}


/*justify-content: flex-start | flex-end | center | space-between | space-around;*/

.flex-container.justify-start {
  -webkit-justify-content: flex-start;
  -ms-flex-pack: start;
  justify-content: flex-start;
}

.flex-container.justify-end {
  -webkit-justify-content: flex-end;
  -ms-flex-pack: end;
  justify-content: flex-end;
}

.flex-container.justify-center {
  -webkit-justify-content: center;
  -ms-flex-pack: center;
  justify-content: center;
}

.flex-container.justify-space-between {
  -webkit-justify-content: space-between;
  -ms-flex-pack: justify;
  justify-content: space-between;
}

.flex-container.justify-space-around {
  -webkit-justify-content: space-around;
  -ms-flex-pack: justify;
  justify-content: space-around;
}


/*align-content: flex-start | flex-end | center | space-between | space-around | stretch;*/

.flex-container.align-content-start {
  -webkit-align-content: flex-start;
  -ms-flex-line-pack: start;
  align-content: flex-start;
}

.flex-container.align-content-end {
  -webkit-align-content: flex-end;
  -ms-flex-line-pack: end;
  align-content: flex-end;
}

.flex-container.align-content-center {
  -webkit-align-content: center;
  -ms-flex-line-pack: center;
  align-content: center;
}

.flex-container.align-content-space-between {
  -webkit-align-content: space-between;
  -ms-flex-line-pack: justify;
  align-content: space-between;
}

.flex-container.align-content-space-around {
  -webkit-align-content: space-around;
  -ms-flex-line-pack: justify;
  /*distribute;*/
  align-content: space-around;
}

.flex-container.align-content-stretch {
  -webkit-align-content: stretch;
  -ms-flex-line-pack: stretch;
  align-content: stretch;
}


/*align-self: auto | flex-start | flex-end | center | baseline | stretch;*/

.item.align-self-auto {
  -webkit-align-self: auto;
  -ms-flex-item-align: auto;
  align-self: auto;
}

.item.align-self-start {
  -webkit-align-self: flex-start;
  -ms-flex-item-align: start;
  align-self: flex-start;
}

.item.align-self-end {
  -webkit-align-self: flex-end;
  -ms-flex-item-align: end;
  align-self: flex-end;
}

.item.align-self-center {
  -webkit-align-self: center;
  -ms-flex-item-align: center;
  align-self: center;
}

.item.align-self-baseline {
  -webkit-align-self: baseline;
  -ms-flex-item-align: baseline;
  align-self: baseline;
}

.item.align-self-stretch {
  -webkit-align-self: stretch;
  -ms-flex-item-align: stretch;
  align-self: stretch;
}

.item.flex-grow1 {
  flex-grow: 1;
}

.item.flex-grow2 {
  flex-grow: 2;
}

.item.flex-grow3 {
  flex-grow: 3;
}

.item.flex-grow4 {
  flex-grow: 4;
}

/* Flex Demos */

.flex-container {
 border: 0.25rem dashed #ccc;
 display : -webkit-flex;
 display : -ms-flexbox;
 display : flex;
 padding: 1rem;
 width: 100%; 
  overflow: hidden;
 }

.item{
	margin: 0; 
  display: inherit;
	padding: 1rem; 
	width: 100px; 
	height: 100px;
	-webkit-align-items: center;
	-ms-flex-align: center;
	align-items: center;
}

.item p{
  width: 70px;
  height: 70px;
  text-align:center;
  font-size: 2rem;
  line-height: 70px;
  color: #777;
  background-color: #FFF;
  border-radius: 100%;
}
#direction .item{
  flex-wrap: wrap;
}

#align .item{
  height:auto; 
  height:auto;
  flex-wrap:wrap;
}	
#align .item:nth-of-type(3) p{
  font-size: 5vw;
}
#justify{ 
  margin: 1rem 0; 
  padding: 1rem 0;
}

#alignContent{flex-wrap:wrap; height:600px;}
#alignContent .item{ height:auto;} 
/* General styles */

html,body{ 
  width: 100%; 
  min-height: 100%; 
  margin: 0; 
  padding: 0; 
  color: #555; 
  font-family: sans-serif;
  /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#fcfff4+0,e9e9ce+100;Wax+3D+%232 */
background: #fcfff4; /* Old browsers */
background: -moz-linear-gradient(left,  #fcfff4 0%, #e9e9ce 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(left,  #fcfff4 0%,#e9e9ce 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to right,  #fcfff4 0%,#e9e9ce 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcfff4', endColorstr='#e9e9ce',GradientType=1 ); /* IE6-9 */

}

*{
	box-sizing : border-box; 
}
/* Main Layout */
.main{
  display: flex;
  flex-direction: row; 
  flex-wrap: wrap;
}
.main-column{ 
  width: calc(100% - 20px); 
  min-width: 300px; 
  margin: 20px; 
}

/* Controls */
.radio{ margin-bottom:20px;}
label{ line-height:200%;}
input[type=radio] { color:white; }
input[type=radio]:checked + label { color:orange; }
input[type=number]{ width:40px; margin-right:.5em;}
h1{ font-size: 2rem;margin:20px;}
h2{ font-size: 1.6rem;margin:0px;}
h4 a{  font-size: 1rem; color:#999; text-decoration:none;}
h4 small{font-variant: normal; font-size: .8rem; font-weight:normal; color:#57bcdb;}
table{ width:100%; margin-bottom:1em;}
table td{ width:50%; padding:3px;}
.principal:last-of-type h4 small{ color:#ff8080;}
#FCI1{ min-height:300px;}
#FCI1 .item{ height:auto;}
#FCI3 .item{ width:25%;}
#FCI4 .item{ width:50%;}
#FCI5 .item{ width:20%;}


@media only screen and (max-width:580px) {
  .item{ 
    width:70px;
    height:70px;
  }
  .main-column{ 
    width: calc(100% - 40px); 
    min-width: initial;
  }
  .flex-container{
    width:100vw;  
    min-width: initial;
  }	
  .item p{
    width: 40px;
    height: 40px;
    display: block;
    font-size: 4vw;
    line-height: 40px;
    color: #777;
    background-color: #FFF;
    border-radius: 100%;
  }
}

/* General style */
header{
  width: 100%;
  display: block;
  background: #FFF;
  height: 40px;
  margin-bottom: 2%;
  color: #ccc;
  font-family: sans-serif;
  font-weight: bold;
  box-shadow: 0px 2px 0px 0px rgba(125,121,125,0.3);
  overflow: hidden;
}
header h1, header a{
  display: inline-block;
  font-size: .8rem;
  margin: auto 10px;
  line-height: 40px;

}
header h1{
    text-transform: uppercase;
    letter-spacing: 1px;
}
header a{
  text-decoration: none;
  background-color: #eee;
  color: #999;
  padding: 0 20px;
  transition: all ease-in-out .3s;
}
header a:hover{
  background-color: rgb(42, 128, 185);
  color: #eee;
  margin-left: -3px;
}
            
          
!
            
              function changeFlex(e, t) {
  for (var n = document.querySelectorAll("." + e), l = document.querySelector("#" + t), r = 0; r < n.length; r++) n[r].addEventListener("change", function() {
    var e = this.value;
    l.setAttribute("class", "flex-container " + e)
  }, !1)
}

function changeItemFlex(e, t) {
  for (var n = document.querySelectorAll("." + e), l = document.querySelector("#" + t), r = 0; r < n.length; r++) n[r].addEventListener("change", function() {
    var e = this.value;
    l.setAttribute("class", "item " + e)
  }, !1)
}

function changeFlexBasis(e, t) {
  var n = isNaN(e.value) ? 0 : e.value;
  console.log("B: " + n), document.querySelector("#" + t).style.WebkitFlexBasis = n + "%", document.querySelector("#" + t).style.flexBasis = n + "%"
}

function changeFlexGrow(e, t) {
  var n = isNaN(e.value) ? 0 : e.value;
  console.log("G: " + n), document.querySelector("#" + t).style.WebkitFlexGrow = n, document.querySelector("#" + t).style.flexGrow = n
}

function changeFlexShrink(e, t) {
  var n = isNaN(e.value) ? 0 : e.value;
  console.log("S: " + n), document.querySelector("#" + t).style.WebkitFlexShrink = n, document.querySelector("#" + t).style.flexShrink = n
}

function changeFlexOrder(e, t) {
  var n = isNaN(e.value) ? 0 : e.value;
  console.log("O: " + n), document.querySelector("#" + t).style.WebkitOrder = n, document.querySelector("#" + t).style.order = n
}

function changeAll(e, t, n, l) {
  changeFlexBasis(e, l), changeFlexGrow(t, l), changeFlexShrink(n, l)
}
for (var items = document.querySelectorAll(".item"), i = 0; i < items.length; i++)
  if (items[i].hasAttribute("data-color")) {
    var color = items[i].getAttribute("data-color");
    items[i].style.backgroundColor = "#" + color
  }
for (var flexO = document.querySelectorAll(".flex-order"), o = 0; o < flexO.length; o++) flexO[o].addEventListener("change", function() {
  changeFlexOrder(this, "order" + this.id)
}, !1);
changeFlex("flex-direction", "direction"), changeFlex("flex-wrap", "wrap"), changeFlex("flex-align-items", "align"), changeFlex("justify-content", "justify"), changeFlex("align-content", "alignContent"), changeItemFlex("align-self", "alignSelf");
for (var flexGrow = document.querySelectorAll(".flex-grow"), i = 0; i < flexGrow.length; i++) flexGrow[i].addEventListener("change", function() {
  var e = "item" + this.id;
  changeFlexGrow(this, e)
});
for (var flexShrink = document.querySelectorAll(".flex-shrink"), j = 0; j < flexShrink.length; j++) flexShrink[j].addEventListener("change", function() {
  var e = "item" + this.id;
  changeFlexShrink(this, e)
});
var B1 = document.querySelector("#B1"),
  G1 = document.querySelector("#G1"),
  S1 = document.querySelector("#S1"),
  B2 = document.querySelector("#B2"),
  G2 = document.querySelector("#G2"),
  S2 = document.querySelector("#S2");
B1.addEventListener("change", function() {
  changeAll(B1, G1, S1, "item1")
}), G1.addEventListener("change", function() {
  changeAll(B1, G1, S1, "item1")
}), S1.addEventListener("change", function() {
  changeAll(B1, G1, S1, "item1")
}), B2.addEventListener("change", function() {
  changeAll(B2, G2, S2, "item2")
}), G2.addEventListener("change", function() {
  changeAll(B2, G2, S2, "item2")
}), S2.addEventListener("change", function() {
  changeAll(B2, G2, S2, "item2")
});
            
          
!
999px
🕑 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 ..................

Console