Pen Settings

HTML

CSS

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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <h2>Flex container</h2>

<table class="table table-bordered table-flexbox">
  <tbody>

    <tr>
      <td colspan="2" class="table-colspan">
        <h3>Do you want the container to behave like a block or inline element?</h3>
        <p>The containers can act like block or inline elements. If you change this to <code>inline-flex</code> they will nudge up together like a list of images would.</p>

      </td>
    </tr>


    <tr>
      <!--   css     -->
      <td>
    
        <div class="thead">CSS</div>

        <code>display:</code> <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/CSS/display#Values">read docs</a>
        <dl class="dl-horizontal">
          <dt>flex</dt>
          <dd>makes the container act display block</dd>
          <dt>inline-flex</dt>
          <dd>makes the container act display inline</dd>
        </dl>


      </td>
      <!--   bootstrap     -->
      <td>
        
                <div class="thead">Bootstrap</div>


        <p>Use one or a combination of classes below to specify what breakpoints you would like the properties to be applied.</p> <a target="_blank" href="http://getbootstrap.com/docs/4.0/utilities/flex/#enable-flex-behaviors">read docs</a>
        <ul>
          <li><code>.d-flex</code></li>
          <li><code>.d-inline-flex</code></li>
          <li><code>.d-sm-flex</code></li>
          <li><code>.d-sm-inline-flex</code></li>
          <li><code>.d-md-flex</code></li>
          <li><code>.d-md-inline-flex</code></li>
          <li><code>.d-lg-flex</code></li>
          <li><code>.d-lg-inline-flex</code></li>
          <li><code>.d-xl-flex</code></li>
          <li><code>.d-xl-inline-flex</code></li>
        </ul>


      </td>
    </tr>
    <tr>
      <td colspan="2" class="table-colspan">

        <h3>Do you want your main axis to be vertical or horizontal?</h3>


      </td>
    </tr>

    <tr class="thead">
      <td>CSS</td>
      <td>Bootstrap 4</td>
    </tr>


    <tr>

      <!--   css     -->
      <td>


        <code>flex-direction:</code> <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/CSS/flex-direction">read docs</a>
        <dl class="dl-horizontal">
          <dt>row (default)</dt>
          <dd>left to right</dd>
          <dt>row-reverse</dt>
          <dd>right to left</dd>
          <dt>column</dt>
          <dd>top to bottom</dd>
          <dt>column</dt>
          <dd>reverse = bottom to top</dd>
        </dl>


      </td>
      <!--   bootstrap     -->
      <td>
        <p>Use one or a combination of classes below to specify what breakpoints you would like the properties to be applied.</p> <a target="_blank" href="http://getbootstrap.com/docs/4.0/utilities/flex/#direction">read docs</a>

        <ul>
          <li><code>.flex-row</code></li>
          <li><code>.flex-row-reverse</code></li>
          <li><code>.flex-column</code></li>
          <li><code>.flex-column-reverse</code></li>
          <li><code>.flex-sm-row</code></li>
          <li><code>.flex-sm-row-reverse</code></li>
          <li><code>.flex-sm-column</code></li>
          <li><code>.flex-sm-column-reverse</code></li>
          <li><code>.flex-md-row</code></li>
          <li><code>.flex-md-row-reverse</code></li>
          <li><code>.flex-md-column</code></li>
          <li><code>.flex-md-column-reverse</code></li>
          <li><code>.flex-lg-row</code></li>
          <li><code>.flex-lg-row-reverse</code></li>
          <li><code>.flex-lg-column</code></li>
          <li><code>.flex-lg-column-reverse</code></li>
          <li><code>.flex-xl-row</code></li>
          <li><code>.flex-xl-row-reverse</code></li>
          <li><code>.flex-xl-column</code></li>
          <li><code>.flex-xl-column-reverse</code></li>
        </ul>

      </td>
    </tr>

    <tr>
      <td colspan="2" class="table-colspan">
        <h3>How do you want the extra space to be distributed along the main axis?</h3>


      </td>
    </tr>
    <tr class="thead">
      <td>CSS</td>
      <td>Bootstrap 4</td>
    </tr>

    <tr>

      <!--   css     -->
      <td>


        <code>justify-content:</code> <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content">read docs</a>


        <dl class="dl-horizontal">
          <dt>flex-start (default)</dt>
          <dd>items anchored to the start</dd>
          <dt>flex-end</dt>
          <dd>items anchored to the start</dd>
          <dt>center</dt>
          <dd>items centered</dd>
          <dt>space-between</dt>
          <dd>items evenly distributed in the line. First item in on the start and last item is at the end</dd>
          <dt>space-around</dt>
          <dd>start and end items are not to the edge but have 1 unit of space on each side</dd>
          <dt>space-evenly</dt>
          <dd>similar to space-around, except all space is the same</dd>

        </dl>


      </td>
      <!--   bootstrap     -->
      <td>

        <p>Use one or a combination of classes below to specify what breakpoints you would like the properties to be applied.</p> <a target="_blank" href="http://getbootstrap.com/docs/4.0/utilities/flex/#justify-content">read docs</a>

        <ul>
          <li><code>.justify-content-start</code></li>
          <li><code>.justify-content-end</code></li>
          <li><code>.justify-content-center</code></li>
          <li><code>.justify-content-between</code></li>
          <li><code>.justify-content-around</code></li>
          <li><code>.justify-content-sm-start</code></li>
          <li><code>.justify-content-sm-end</code></li>
          <li><code>.justify-content-sm-center</code></li>
          <li><code>.justify-content-sm-between</code></li>
          <li><code>.justify-content-sm-around</code></li>
          <li><code>.justify-content-md-start</code></li>
          <li><code>.justify-content-md-end</code></li>
          <li><code>.justify-content-md-center</code></li>
          <li><code>.justify-content-md-between</code></li>
          <li><code>.justify-content-md-around</code></li>
          <li><code>.justify-content-lg-start</code></li>
          <li><code>.justify-content-lg-end</code></li>
          <li><code>.justify-content-lg-center</code></li>
          <li><code>.justify-content-lg-between</code></li>
          <li><code>.justify-content-lg-around</code></li>
          <li><code>.justify-content-xl-start</code></li>
          <li><code>.justify-content-xl-end</code></li>
          <li><code>.justify-content-xl-center</code></li>
          <li><code>.justify-content-xl-between</code></li>
          <li><code>.justify-content-xl-around</code></li>
        </ul>

      </td>
    </tr>

    <tr>
      <td colspan="2" class="table-colspan">

        <h3>How do you want the extra space of LINES of items to be distributed along the cross axis?</h3>

      </td>
    </tr>
    <tr class="thead">
      <td>CSS</td>
      <td>Bootstrap 4</td>
    </tr>

    <tr>
      <!--   css     -->
      <td>


        <code>align-content:</code> <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/CSS/align-content">read docs</a>
        <dl class="dl-horizontal">
          <dt>flex-start</dt>
          <dd>items anchored to the start</dd>
          <dt>flex-end</dt>
          <dd>items anchored to the end</dd>
          <dt>center</dt>
          <dd>items centered</dd>
          <dt>space-between</dt>
          <dd>first line at the start of the container and the last one is at the end</dd>
          <dt>space-around</dt>
          <dd>lines are evenly distributed with equal space around each line</dd>
          <dt>stretch (default)</dt>
          <dd>lines stretch to take up the space that is left</dd>
        </dl>

      </td>
      <!--   bootstrap     -->
      <td>

        <p>Use one or a combination of classes below to specify what breakpoints you would like the properties to be applied.</p> <a target="_blank" href="http://getbootstrap.com/docs/4.0/utilities/flex/#align-content">read docs</a>

        <ul>
          <li><code>.align-content-start</code></li>
          <li><code>.align-content-end</code></li>
          <li><code>.align-content-center</code></li>
          <li><code>.align-content-around</code></li>
          <li><code>.align-content-stretch</code></li>
          <li><code>.align-content-sm-start</code></li>
          <li><code>.align-content-sm-end</code></li>
          <li><code>.align-content-sm-center</code></li>
          <li><code>.align-content-sm-around</code></li>
          <li><code>.align-content-sm-stretch</code></li>
          <li><code>.align-content-md-start</code></li>
          <li><code>.align-content-md-end</code></li>
          <li><code>.align-content-md-center</code></li>
          <li><code>.align-content-md-around</code></li>
          <li><code>.align-content-md-stretch</code></li>
          <li><code>.align-content-lg-start</code></li>
          <li><code>.align-content-lg-end</code></li>
          <li><code>.align-content-lg-center</code></li>
          <li><code>.align-content-lg-around</code></li>
          <li><code>.align-content-lg-stretch</code></li>
          <li><code>.align-content-xl-start</code></li>
          <li><code>.align-content-xl-end</code></li>
          <li><code>.align-content-xl-center</code></li>
          <li><code>.align-content-xl-around</code></li>
          <li><code>.align-content-xl-stretch</code></li>
        </ul>


      </td>
    </tr>

    <tr>
      <td colspan="2" class="table-colspan">

        <h3>How do you want the extra space between items to be distributed along the cross axis?</h3>


      </td>
    </tr>
    <tr class="thead">
      <td>CSS</td>
      <td>Bootstrap 4</td>
    </tr>

    <tr>
      <!--   css     -->
      <td>


        <code>align-items:</code> <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/CSS/align-items">read docs</a>
        <dl class="dl-horizontal">
          <dt>flex-start</dt>
          <dd>cross axis align items to start</dd>
          <dt>flex-end</dt>
          <dd>cross axis align items to end</dd>
          <dt>center</dt>
          <dd>cross axis align items center</dd>
          <dt>baseline</dt>
          <dd>align baselines</dd>
          <dt>stretch (default)</dt>
          <dd>stretch to fill the container</dd>
        </dl>


      </td>
      <!--   bootstrap     -->
      <td>

        <p>Use one or a combination of classes below to specify what breakpoints you would like the properties to be applied.</p> <a target="_blank" href="http://getbootstrap.com/docs/4.0/utilities/flex/#align-items">read docs</a>


        <ul>
          <li><code>.align-items-start</code></li>
          <li><code>.align-items-end</code></li>
          <li><code>.align-items-center</code></li>
          <li><code>.align-items-baseline</code></li>
          <li><code>.align-items-stretch</code></li>
          <li><code>.align-items-sm-start</code></li>
          <li><code>.align-items-sm-end</code></li>
          <li><code>.align-items-sm-center</code></li>
          <li><code>.align-items-sm-baseline</code></li>
          <li><code>.align-items-sm-stretch</code></li>
          <li><code>.align-items-md-start</code></li>
          <li><code>.align-items-md-end</code></li>
          <li><code>.align-items-md-center</code></li>
          <li><code>.align-items-md-baseline</code></li>
          <li><code>.align-items-md-stretch</code></li>
          <li><code>.align-items-lg-start</code></li>
          <li><code>.align-items-lg-end</code></li>
          <li><code>.align-items-lg-center</code></li>
          <li><code>.align-items-lg-baseline</code></li>
          <li><code>.align-items-lg-stretch</code></li>
          <li><code>.align-items-xl-start</code></li>
          <li><code>.align-items-xl-end</code></li>
          <li><code>.align-items-xl-center</code></li>
          <li><code>.align-items-xl-baseline</code></li>
          <li><code>.align-items-xl-stretch</code></li>
        </ul>


      </td>
    </tr>

    <tr>
      <td colspan="2" class="table-colspan">

        <h3>Do you want the items to wrap if they don't fit on one line?</h3>

        <p>By default, flex items will try to fit all the items onto one line.</p>


      </td>
    </tr>
    <tr class="thead">
      <td>CSS</td>
      <td>Bootstrap 4</td>
    </tr>


    <tr>
      <!--   css     -->
      <td>

        <code>flex-wrap:</code> <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/CSS/flex-wrap">read docs</a>
        <dl class="dl-horizontal">
          <dt>nowrap (default)</dt>
          <dd>all items will try to stay on one line</dd>
          <dt>wrap</dt>
          <dd>if items don't fit they will wrap and create a new line below</dd>
          <dt>wrap-reverse</dt>
          <dd>if items don't fit they will wrap and create a new line above</dd>
        </dl>

      </td>
      <!--   bootstrap     -->
      <td>

        <p>Use one or a combination of classes below to specify what breakpoints you would like the properties to be applied.</p> <a target="_blank" href="http://getbootstrap.com/docs/4.0/utilities/flex/#wrap">read docs</a>


        <ul>
          <li><code>.flex-nowrap</code></li>
          <li><code>.flex-wrap</code></li>
          <li><code>.flex-wrap-reverse</code></li>
          <li><code>.flex-sm-nowrap</code></li>
          <li><code>.flex-sm-wrap</code></li>
          <li><code>.flex-sm-wrap-reverse</code></li>
          <li><code>.flex-md-nowrap</code></li>
          <li><code>.flex-md-wrap</code></li>
          <li><code>.flex-md-wrap-reverse</code></li>
          <li><code>.flex-lg-nowrap</code></li>
          <li><code>.flex-lg-wrap</code></li>
          <li><code>.flex-lg-wrap-reverse</code></li>
          <li><code>.flex-xl-nowrap</code></li>
          <li><code>.flex-xl-wrap</code></li>
          <li><code>.flex-xl-wrap-reverse</code></li>
        </ul>


      </td>
    </tr>

    <tr>
      <td colspan="2" class="table-colspan">

        <h3>Shorthand property</h3>
        <p>This is a shorthand property that sets the <code>flex-direction</code> and <code>flex-wrap</code> properties. I suggest avoid using this until you learn the core properties because it could make things more confusing.</p>

      </td>
    </tr>

    <tr class="thead">
      <td>CSS</td>
      <td>Bootstrap 4</td>
    </tr>

    <tr>
      <!--   css     -->
      <td>


        <code>flex-flow:</code> <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/CSS/flex-flow">read docs</a>
        <dl><dt>< flex-direction > < flex-wrap ></dt>
          <dd>example: <code>flex-flow: column-reverse wrap-reverse;</code> or just <code>flex-flow: wrap-reverse;</code></dd>
        </dl>


      </td>
      <!--   bootstrap     -->
      <td>

        <p>Does not apply because Bootstrap has pre-written the properties with classes.</p>
      </td>
    </tr>

  </tbody>
</table>








<h2>Flex Item</h2>
<p>Do you want to override the parent settings and give a specific item their own unique settings? You will first need to write a custom class and add it to the item you would like to modify.</p>

<h4>Example:</h4>
<h5>HTML</h5>
<pre>
  &lt;div class="flex-container"&gt;
    <b class="text-danger">&lt;div class="flex-item-a"&gt;.flex-item-a&lt;/div&gt;</b>
    &lt;div class="flex-item-b"&gt;.flex-item-b&lt;/div&gt;
    &lt;div class="flex-item-c"&gt;.flex-item-c&lt;/div&gt;
  &lt;/div&gt;
</pre>
<h5>CSS</h5>
<pre>
  .flex-item-a {
    order: 3;
    font-weight: bold;
  }
</pre>
<h5>Result</h5>
https://codepen.io/JacobLett/pen/pdojMP













<table class="table table-bordered table-flexbox">
  <tbody>

    <tr>
      <td colspan="2" class="table-colspan">

<h3>Do you want to change the order of this item relative to the other items?</h3>

      </td>
    </tr>
    <tr class="thead">
      <td>CSS</td>
      <td>Bootstrap 4</td>
    </tr>

    <tr>
      <!--   css     -->
      <td>




<code>order:</code> <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/CSS/order">read docs</a>
<dl class="dl-horizontal">
  <dt>[number]</dt>
  <dd>default is 0</dd>
</dl>



      </td>
      <!--   bootstrap     -->
      <td>

      </td>
    </tr>
        <tr>
      <td colspan="2" class="table-colspan">

<h3>Do you want to have this item take up more space than the other items?</h3>


      </td>
    </tr>
    <tr class="thead">
      <td>CSS</td>
      <td>Bootstrap 4</td>
    </tr>

    <tr>
      <!--   css     -->
      <td>




<code>flex-grow:</code> <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/CSS/flex-grow">read docs</a>
<dl class="dl-horizontal">
  <dt>[number]</dt>
  <dd>default 0</dd>
</dl>




      </td>
      <!--   bootstrap     -->
      <td>

      </td>
    </tr>
        <tr>
      <td colspan="2" class="table-colspan">
        <h3>Do you want this item to take less space than the other items?</h3>


      </td>
    </tr>
    <tr class="thead">
      <td>CSS</td>
      <td>Bootstrap 4</td>
    </tr>

    <tr>
      <!--   css     -->
      <td>



<code>flex-shrink:</code> <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/CSS/flex-shrink">read docs</a>
<dl class="dl-horizontal">
  <dt>[number]</dt>
  <dd>default 1</dd>
</dl>



      </td>
      <!--   bootstrap     -->
      <td>

      </td>
    </tr>
        <tr>
      <td colspan="2" class="table-colspan">
<h3>Do you want to set the default size of this item before the other item sizes are set?</h3>


      </td>
    </tr>
    <tr class="thead">
      <td>CSS</td>
      <td>Bootstrap 4</td>
    </tr>

    <tr>
      <!--   css     -->
      <td>





<code>flex-basis: </code> <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/CSS/flex-basis">read docs</a>

<dl class="dl-horizontal">
  <dt>[length]</dt>
  <dd>A number followed by px, em, rem, or %. Check the docs for additional keywords</dd>
  <dt>auto (default)</dt>
  <dd>look at my width or height property</dd>
</dl>




      </td>
      <!--   bootstrap     -->
      <td>

      </td>
    </tr>
        <tr>
      <td colspan="2" class="table-colspan">

<h3>Do you want to override the align-items value for this item?</h3>
      </td>
    </tr>
    <tr class="thead">
      <td>CSS</td>
      <td>Bootstrap 4</td>
    </tr>

    <tr>
      <!--   css     -->
      <td>



<code>align-self:</code> <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/CSS/align-self">read docs</a>
<dl class="dl-horizontal">
  <dt>auto</dt>
  <dd>#</dd>
  <dt>flex-start</dt>
  <dd>#</dd>
  <dt>flex-end</dt>
  <dd>#</dd>
  <dt>center</dt>
  <dd>#</dd>
  <dt>baseline</dt>
  <dd>#</dd>
  <dt>stretch (default)</dt>
  <dd>#</dd>
</dl>



      </td>
      <!--   bootstrap     -->
      <td>

      </td>
    </tr>
        <tr>
      <td colspan="2" class="table-colspan">

<h3>Shorthand property</h3>

<p>This is the shorthand for flex-grow, flex-shrink and flex-basis combined.</p>


      </td>
    </tr>
    <tr class="thead">
      <td>CSS</td>
      <td>Bootstrap 4</td>
    </tr>

    <tr>
      <!--   css     -->
      <td>




<code>flex:</code> <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/CSS/flex">read docs</a>
<dl class="dl-horizontal">
  <dt>example:</dt>
  <dd>Three values: flex-grow | flex-shrink | flex-basis <code>flex: 2 2 10%;</code></dd>
</dl>




      </td>
      <!--   bootstrap     -->
      <td>

      </td>
    </tr>



  </tbody>
</table>




              
            
!

CSS

              
                


@media screen and (max-width: 480px) {

  .table-flexbox td {
    width:100%!important;
    display: block;
  }
}


.table-flexbox .thead {
  font-weight: bold;
  text-align: center;
  font-size:12px;
   background:#eee;
  padding:.5rem;
  margin-bottom:1rem;
}


.table-flexbox td{
    width: 50%;
    text-align: left;
    border: 1px solid black;
}

.table-flexbox .table-colspan {
text-align:center;
  padding:0 2rem;
  background:#fcf8e3;
}
              
            
!

JS

              
                $(document).ready(function() {
 // executes when HTML-Document is loaded and DOM is ready
console.log("document is ready");
  
  
// document ready  
});


$(window).load(function() {
 // executes when complete page is fully loaded, including all frames, objects and images
console.log("window is loaded");
  
  
// window load  
});
              
            
!
999px

Console