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

              
                <div class="layout" id="layout">
  <div class="section">
    <h4 id="flex-direction">
      <a href="#flex-direction" class="headerlink" title="flex-direction"></a>
      flex-direction:
    </h4>
    <div class="section-flexbox direction clearfix">
      <div class="item">
        <ul class="direction-row border">
          <li>1</li>
          <li>2</li>
          <li>3</li>
        </ul>
        <p>row</p>
      </div>
      <div class="item">
        <ul class="direction-column border">
          <li>1</li>
          <li>2</li>
          <li>3</li>
        </ul>
        <p>column</p>
      </div>
      <div class="item">
        <ul class="direction-row-reverse border">
          <li>1</li>
          <li>2</li>
          <li>3</li>
        </ul>
        <p>row-reverse</p>
      </div>
      <div class="item">
        <ul class="direction-column-reverse border">
          <li>1</li>
          <li>2</li>
          <li>3</li>
        </ul>
        <p>column-reverse</p>
      </div>
    </div>
  </div>
  <div class="section">
    <h4 id="flex-wrap">
      <a href="#flex-wrap" class="headerlink" title="flex-wrap"></a>
      flex-wrap:
    </h4>
    <div class="section-flexbox flex-wrap clearfix">
      <div class="item">
        <ul class="wrap-reverse border">
          <li>1</li>
          <li>2</li>
          <li>3</li>
          <li>4</li>
          <li>5</li>
          <li>6</li>
        </ul>
        <p>wrap-reverse</p>
      </div>
      <div class="item">
        <ul class="wrap border">
          <li>1</li>
          <li>2</li>
          <li>3</li>
          <li>4</li>
          <li>5</li>
          <li>6</li>
        </ul>
        <p>wrap</p>
      </div>
      <div class="item">
        <ul class="nowrap border">
          <li>1</li>
          <li>2</li>
          <li>3</li>
          <li>4</li>
          <li>5</li>
          <li>6</li>
        </ul>
        <p>nowrap</p>
      </div>
    </div>
  </div>
  <div class="section">
    <h4 id="flex-flow">
      <a href="#flex-flow" class="headerlink" title="flex-flow"></a>
      flex-flow:
    </h4>
    <div class="section-flexbox flex-flow clearfix">
      <div class="item">
        <ul class="row-wrap border">
          <li>1</li>
          <li>2</li>
          <li>3</li>
          <li>4</li>
        </ul>
        <p>row wrap</p>
      </div>
      <div class="item">
        <ul class="column-wrap border">
          <li>1</li>
          <li>2</li>
          <li>3</li>
          <li>4</li>
        </ul>
        <p>column wrap</p>
      </div>
      <div class="item">
        <ul class="column-wrap-reverse border">
          <li>1</li>
          <li>2</li>
          <li>3</li>
          <li>4</li>
        </ul>
        <p>column wrap-reverse</p>
      </div>
    </div>
  </div>
  <div class="section">
    <h4 id="justify-content">
      <a href="#justify-content" class="headerlink" title="justify-content"></a>
      justify-content:
    </h4>
    <div class="section-flexbox justify-content clearfix">
      <div class="item">
        <ul class="justify-content-flex-start border">
          <li>1</li>
          <li>2</li>
          <li>3</li>
        </ul>
        <p>flex-start</p>
      </div>
      <div class="item">
        <ul class="justify-content-center border">
          <li>1</li>
          <li>2</li>
          <li>3</li>
        </ul>
        <p>center</p>
      </div>
      <div class="item">
        <ul class="justify-content-space-between border">
          <li>1</li>
          <li>2</li>
          <li>3</li>
        </ul>
        <p>space-between</p>
      </div>
      <div class="item">
        <ul class="justify-content-space-around border">
          <li>1</li>
          <li>2</li>
          <li>3</li>
        </ul>
        <p>space-around</p>
      </div>
    </div>
  </div>
  <div class="section">
    <h4 id="align-items">
      <a href="#align-items" class="headerlink" title="align-items"></a>
      align-items:
    </h4>
    <div class="section-flexbox align-items clearfix">
      <div class="item">
        <ul class="align-items-center border">
          <li>1</li>
          <li>2</li>
          <li>3</li>
        </ul>
        <p>center</p>
      </div>
      <div class="item">
        <ul class="align-items-flex-end border">
          <li>1</li>
          <li>2</li>
          <li>3</li>
        </ul>
        <p>flex-end</p>
      </div>
      <div class="item">
        <ul class="align-items-stretch border">
          <li>1</li>
          <li>2</li>
          <li>3</li>
        </ul>
        <p>stretch</p>
      </div>
      <div class="item">
        <ul class="align-items-baseline border">
          <li>1</li>
          <li>2</li>
          <li>3</li>
        </ul>
        <p>baseline</p>
      </div>
    </div>
  </div>
  <div class="section">
    <h4 id="align-content">
      <a href="#align-content" class="headerlink" title="align-content"></a>
      align-content:
    </h4>
    <div class="section-flexbox align-content clearfix">
      <div class="item">
        <ul class="align-content-center border">
          <li>1</li>
          <li>2</li>
          <li>3</li>
          <li>4</li>
        </ul>
        <p>center</p>
      </div>
      <div class="item">
        <ul class="align-content-stretch border">
          <li>1</li>
          <li>2</li>
          <li>3</li>
          <li>4</li>
        </ul>
        <p>stretch</p>
      </div>
      <div class="item">
        <ul class="align-content-space-between border">
          <li>1</li>
          <li>2</li>
          <li>3</li>
          <li>4</li>
        </ul>
        <p>space-between</p>
      </div>
      <div class="item">
        <ul class="align-content-space-around border">
          <li>1</li>
          <li>2</li>
          <li>3</li>
          <li>4</li>
        </ul>
        <p>space-around</p>
      </div>
    </div>
  </div>
  <div class="section">
    <h4 id="align-self">
      <a href="#align-self" class="headerlink" title="align-self"></a>
      align-self:
    </h4>
    <div class="section-flexbox align-self clearfix">
      <div class="item">
        <ul class="align-self-start border">
          <li>1</li>
        </ul>
        <p>flex-start</p>
      </div>
      <div class="item">
        <ul class="align-self-center border">
          <li>2</li>
        </ul>
        <p>center</p>
      </div>
      <div class="item">
        <ul class="align-self-end border">
          <li>3</li>
        </ul>
        <p>flex-end</p>
      </div>
      <div class="item">
        <ul class="align-self-stretch border">
          <li>4</li>
        </ul>
        <p>stretch</p>
      </div>
      <div class="item">
        <ul class="align-self-baseline border">
          <li>5</li>
          <li>6</li>
          <li>7</li>
        </ul>
        <p>baseline</p>
      </div>
      <div class="item">
        <ul class="align-self-auto border">
          <li>8</li>
        </ul>
        <p>auto</p>
      </div>
    </div>
  </div>
  <div class="section">
    <h4 id="order">
      <a href="#order" class="headerlink" title="order"></a>
      order:
    </h4>
    <div class="section-flexbox order clearfix">
      <div class="item">
        <ul class="border">
          <li>1</li>
          <li>2</li>
          <li>3</li>
          <li>4</li>
          <li>5</li>
        </ul>
        <p><span>-2</span><span>0</span><span>0</span><span>1</span><span>3</span></p>
      </div>
    </div>
  </div>
  <div class="section">
    <h4 id="flex-grow">
      <a href="#flex-grow" class="headerlink" title="flex-grow"></a>
      flex-grow:
    </h4>
    <div class="section-flexbox flex-grow clearfix">
      <div class="item">
        <ul class="border">
          <li>1</li>
          <li>2</li>
          <li>3</li>
          <li>4</li>
          <li>5</li>
        </ul>
        <p class="flexbox"><span>50px</span><span>1</span><span>2</span><span>3</span><span>80px</span></p>
      </div>
    </div>
  </div>
  <div class="section">
    <h4 id="flex-shrink">
      <a href="#flex-grow" class="headerlink" title="flex-shrink"></a>
      flex-shrink:
    </h4>
    <div class="section-flexbox flex-shrink clearfix">
      <div class="item">
        <ul class="border">
          <li>1</li>
          <li>2</li>
          <li>3</li>
          <li>4</li>
          <li>5</li>
        </ul>
        <p class="flexbox"><span>200px</span><span>1</span><span>2</span><span>3</span><span>100px</span></p>
      </div>
    </div>
  </div>
  <div class="section">
    <h4 id="flex-basis">
      <a href="#flex-basis" class="headerlink" title="flex-basis"></a>
      flex-basis:
    </h4>
    <div class="section-flexbox flex-basis clearfix">
      <div class="item">
        <ul class="border">
          <li>1</li>
          <li>2</li>
          <li>3</li>
        </ul>
        <p class="flexbox"><span>150px</span><span>50%</span><span>auto</span></p>
      </div>
    </div>
  </div>
  <div class="section">
    <h4 id="flex">
      <a href="#flex" class="headerlink" title="flex"></a>
      flex:
    </h4>
    <div class="section-flexbox flex clearfix">
      <div class="item">
        <ul class="flex-1 border">
          <li>1</li>
          <li>2</li>
          <li>3</li>
        </ul>
        <p>0</p>
      </div>
      <div class="item">
        <ul class="flex-auto border">
          <li>1</li>
          <li>2</li>
          <li>3</li>
        </ul>
        <p>auto</p>
      </div>
      <div class="item">
        <ul class="flex-none border">
          <li>1</li>
          <li>2</li>
          <li>3</li>
        </ul>
        <p>none</p>
      </div>
      <div class="item">
        <ul class="flex-0-auto border">
          <li>1</li>
          <li>2</li>
          <li>3</li>
        </ul>
        <p>0 auto</p>
      </div>
    </div>
  </div>
</div>
              
            
!

CSS

              
                .clearfix {
    zoom: 1;
}
.clearfix:after {
    content: '';
    display: block;
    visibility: hidden;
    width: 100%;
    height: 0;
    clear: both;
}
ul, li {
    padding: 0;
    margin: 0;
    list-style-type: none;
}
.left {
    float: left;
}
.right {
    float: right;
}
.layout {
    color: #666;
    margin: 0 auto;
}
.section {
    margin: 25px 0;
    width: 700px;
}
.section h4 {
    margin: 15px 0;
    color: #4e4a4a;
    position: relative;
}
.section h4:before {
    content: '#';
    display: block;
    color: #41b883;
    position: absolute;
    font-size: 20px;
    line-height: 22px;
    left: -18px;
    top: 0;
}

* {
    box-sizing: border-box;
}
.border {
    border: 1px solid #ddd;
}
.section-flexbox .item {
    float: left;
    margin-right: 20px;
    margin-bottom: 20px;
}
.section-flexbox ul {
    display: flex;
    padding: 5px;
}
.section-flexbox p span {
    width: 50px;
    display: inline-block;
    margin: 0 5px;
}
.direction-row {
    flex-direction: row;
}
.direction-column {
    flex-direction: column;
}
.direction-row-reverse {
    flex-direction: row-reverse;
}
.direction-column-reverse {
    flex-direction: column-reverse;
}
.section-flexbox .item p {
    text-align: center;
}
.section-flexbox ul li {
    background-color: #ddd;
    width: 50px;
    height: 50px;
    line-height: 50px;
    text-align: center;
    margin: 5px;
}
.section-flexbox ul.direction-column-reverse {
    width: 72px;
}
.flexbox {
    display: flex;
}
.nowrap {
    flex-wrap: nowrap;
}
.wrap {
    flex-wrap: wrap;
}
.wrap-reverse {
    flex-wrap: wrap-reverse;
}
.flex-wrap .item {
    width: 270px;
}
.flex-flow .item {
    width: 192px;
}
.row-wrap {
    flex-flow: row wrap;
}
.column-wrap {
    flex-flow: column wrap;
    height: 192px;
}
.column-wrap-reverse {
    flex-flow: row wrap-reverse;
}
.justify-content ul {
    width: 330px;
}
.justify-content .item {
    float: left;
}
.justify-content-flex-start {
    justify-content: flex-start;
}
.justify-content-center {
    justify-content: center;
}
.justify-content-space-between {
    justify-content: space-between;
}
.justify-content-space-around {
    justify-content: space-around;
}
.align-items ul {
    height: 120px;
}
.align-items-center {
    align-items: center;
}
.align-items-flex-end {
    align-items: flex-end;
}
.align-items-stretch {
    align-items: stretch;
}
.align-items-baseline {
    align-items: baseline;
}
.section-flexbox .align-items-stretch li {
    height: auto;
}
.align-items-stretch li:nth-child(2) {
    max-height: 70%;
}
.align-items-stretch li:nth-child(3) {
    max-height: 50%;
}
.section-flexbox .align-items-baseline li:nth-child(2) {
    font-size: 2em;
}
.section-flexbox .align-items-baseline li:nth-child(3) {
    font-size: 3em;
}
.align-content ul {
    width: 132px;
    height: 190px;
    flex-wrap: wrap;
}
.align-content-center {
    align-content: center;
}
.align-content-stretch {
    align-content: stretch;
}
.align-content-space-between {
    align-content: space-between;
}
.align-content-space-around {
    align-content: space-around;
}
.section-flexbox .align-content-stretch li {
    height: auto;
}
.align-self ul {
    width: 72px;
    height: 120px;
    align-items: flex-end;
}
.align-self-start li {
    align-self: flex-start;
} 
.align-self-center li {
    align-self: center;
} 
.align-self-end li {
    align-self: flex-end;
} 
.align-self-stretch li {
    align-self: stretch;
} 
.align-self .align-self-baseline {
    width: 192px;
}
.align-self .align-self-baseline li:nth-child(2) {
    font-size: 2em;
}
.align-self .align-self-baseline li:nth-child(3) {
    font-size: 3em;
}
.align-self-baseline li {
    align-self: baseline;
} 
.align-self-auto li {
    align-self: auto;
} 
.section-flexbox .align-self-stretch li {
    height: auto;
}
.order li:nth-child(5) {
    order: -2;
}
.order li:nth-child(2) {
    order: 3;
}
.order li:nth-child(4) {
    order: 1;
}
.flex-grow ul {
    width: 600px;
}
.flex-grow ul li:nth-child(1), .flex-grow p span:nth-child(1) {
    width: 50px;
}
.flex-grow ul li:nth-child(2), .flex-grow p span:nth-child(2) {
    width: 50px;
    flex-grow: 1;
}
.flex-grow ul li:nth-child(3), .flex-grow p span:nth-child(3) {
    flex-grow: 2;
}
.flex-grow ul li:nth-child(4), .flex-grow p span:nth-child(4) {
    flex-grow: 3;
}
.flex-grow ul li:nth-child(5), .flex-grow p span:nth-child(5) {
    width: 80px;
}
.flex-shrink ul, .flex-shrink .item p {
    width: 600px;
}
.flex-shrink ul li, .flex-shrink p span {
    width: 200px;
}
.flex-shrink ul li:nth-child(1), .flex-shrink p span:nth-child(1) {
    flex-shrink: 0;
    width: 200px;
}
.flex-shrink ul li:nth-child(3), .flex-shrink p span:nth-child(3) {
    flex-shrink: 2;
}
.flex-shrink ul li:nth-child(4), .flex-shrink p span:nth-child(4) {
    flex-shrink: 3;
}
.flex-shrink ul li:nth-child(5), .flex-shrink p span:nth-child(5) {
    width: 100px;
    flex-shrink: 0;
}
.flex-basis ul {
    width: 600px;
}
.flex-basis ul li:nth-child(1), .flex-basis p span:nth-child(1) {
    flex-basis: 150px;
}
.flex-basis ul li:nth-child(2), .flex-basis p span:nth-child(2) {
    flex-basis: 50%;
}
.flex ul {
    width: 300px;
}
.flex .flex-1 li {
    flex: 1;
}
.flex .flex-auto li {
    flex: auto;
}
.flex .flex-none li {
    flex: none;
}
.flex .flex-0-auto li {
    flex: 0 auto;
    width: auto;
}
              
            
!

JS

              
                
              
            
!
999px

Console