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

              
                <body>
    <h3>flex-direction: row; /*default*/<br>Flex: 1;</h3>
    <div class="flexBox flex-direction_row">
        <div class="item flex_1">DIV1</div>
        <div class="item flex_1">DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2</div>
        <div class="item flex_1">DIV3-DIV3<br>DIV3-DIV3</div>
    </div>
    <h3>Flex: auto</h3>
    <div class="flexBox flex-direction_row">
        <div class="item flex_auto">DIV1</div>
        <div class="item flex_auto">DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2</div>
        <div class="item flex_auto">DIV3-DIV3<br>DIV3-DIV3</div>
    </div>
    <h3>Flex: %</h3>
    <div class="flexBox flex-direction_row">
        <div class="item flex_0_1_10per">DIV1</div>
        <div class="item flex_0_1_60per">DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2</div>
        <div class="item flex_0_1_30per">DIV3-DIV3<br>DIV3-DIV3</div>
    </div>
    <h3>justify-content: flex-start; /*default*/</h3>
    <div class="flexBox flex-direction_row justify-content_flex-start">
        <div class="item flex_0_0_50px">DIV1</div>
        <div class="item flex_0_0_200px">DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2</div>
        <div class="item flex_0_0_100px">DIV3-DIV3<br>DIV3-DIV3</div>
    </div>
    <h3>justify-content: center;</h3>
    <div class="flexBox flex-direction_row justify-content_center">
        <div class="item flex_0_0_50px">DIV1</div>
        <div class="item flex_0_0_200px">DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2</div>
        <div class="item flex_0_0_100px">DIV3-DIV3<br>DIV3-DIV3</div>
    </div>
    <h3>justify-content: flex-end;</h3>
    <div class="flexBox flex-direction_row justify-content_flex-end">
        <div class="item flex_0_0_50px">DIV1</div>
        <div class="item flex_0_0_200px">DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2</div>
        <div class="item flex_0_0_100px">DIV3-DIV3<br>DIV3-DIV3</div>
    </div>
    <h3>justify-content: space-around;</h3>
    <div class="flexBox flex-direction_row justify-content_space-around">
        <div class="item flex_0_0_50px">DIV1</div>
        <div class="item flex_0_0_200px">DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2</div>
        <div class="item flex_0_0_100px">DIV3-DIV3<br>DIV3-DIV3</div>
    </div>
    <h3>justify-content: space-between;</h3>
    <div class="flexBox flex-direction_row justify-content_space-between">
        <div class="item flex_0_0_50px">DIV1</div>
        <div class="item flex_0_0_200px">DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2</div>
        <div class="item flex_0_0_100px">DIV3-DIV3<br>DIV3-DIV3</div>
    </div>
    <h3>align-items: stretch; /*default*/</h3>
    <div class="flexBox flex-direction_row align-items_stretch">
        <div class="item flex_1">DIV1</div>
        <div class="item flex_1">DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2</div>
        <div class="item flex_1">DIV3-DIV3<br>DIV3-DIV3</div>
    </div>
    <h3>align-items: flex-start;</h3>
    <div class="flexBox flex-direction_row align-items_flex-start">
        <div class="item flex_1">DIV1</div>
        <div class="item flex_1">DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2</div>
        <div class="item flex_1">DIV3-DIV3<br>DIV3-DIV3</div>
    </div>
    <h3>align-items: center;</h3>
    <div class="flexBox flex-direction_row align-items_center">
        <div class="item flex_1">DIV1</div>
        <div class="item flex_1">DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2</div>
        <div class="item flex_1">DIV3-DIV3<br>DIV3-DIV3</div>
    </div>
    <h3>align-items: flex-end;</h3>
    <div class="flexBox flex-direction_row align-items_flex-end">
        <div class="item flex_1">DIV1</div>
        <div class="item flex_1">DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2</div>
        <div class="item flex_1">DIV3-DIV3<br>DIV3-DIV3</div>
    </div>
    <h3>align-items: baseline;</h3>
    <div class="flexBox flex-direction_row align-items_baseline">
        <div class="item flex_1">DIV1</div>
        <div class="item flex_1">DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2</div>
        <div class="item flex_1">DIV3-DIV3<br>DIV3-DIV3</div>
    </div>
    <h3>flex-direction: row-reverse;<br>Flex: 1;</h3>
    <div class="flexBox flex-direction_row-reverse">
        <div class="item flex_1">DIV1</div>
        <div class="item flex_1">DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2</div>
        <div class="item flex_1">DIV3-DIV3<br>DIV3-DIV3</div>
    </div>
    <h3>order<br>Flex: 1;</h3>
    <div class="flexBox flex-direction_row-reverse">
        <div class="item flex_1 order_1">DIV1</div>
        <div class="item flex_1 order_3">DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2</div>
        <div class="item flex_1 order_2">DIV3-DIV3<br>DIV3-DIV3</div>
    </div>
    <h3>flex-direction: column;</h3>
    <div class="flexBox flex-direction_column">
        <div class="item flex_1">DIV1</div>
        <div class="item flex_1">DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2</div>
        <div class="item flex_1">DIV3-DIV3<br>DIV3-DIV3</div>
    </div>
    <h3>flex-direction: column-reverse;</h3>
    <div class="flexBox flex-direction_column-reverse">
        <div class="item flex_1">DIV1</div>
        <div class="item flex_1">DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2</div>
        <div class="item flex_1">DIV3-DIV3<br>DIV3-DIV3</div>
    </div>
    <h3>flex-wrap: nowrap; /*default*/<br>flex: px;</h3>
    <div class="flexBox flex-wrap_nowrap">
        <div class="item flex_0_0_200px">DIV1</div>
        <div class="item flex_0_0_300px">DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2</div>
        <div class="item flex_0_0_500px">DIV3-DIV3<br>DIV3-DIV3</div>
    </div>
    <h3>flex-wrap: wrap;<br>flex: px;</h3>
    <div class="flexBox flex-wrap_wrap">
        <div class="item flex_0_0_200px">DIV1</div>
        <div class="item flex_0_0_300px">DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2</div>
        <div class="item flex_0_0_500px">DIV3-DIV3<br>DIV3-DIV3</div>
    </div>
    <h3>flex-wrap: wrap-reverse;<br>flex: px;</h3>
    <div class="flexBox flex-wrap_wrap-reverse">
        <div class="item flex_0_0_200px">DIV1</div>
        <div class="item flex_0_0_300px">DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2</div>
        <div class="item flex_0_0_500px">DIV3-DIV3<br>DIV3-DIV3</div>
    </div>
    <h3>flex-wrap<br>align-content: stretch;</h3>
    <div class="flexBox2 flex-wrap_wrap align-content_stretch">
        <div class="item2">DIV1</div>
        <div class="item2">DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2</div>
        <div class="item2">DIV3-DIV3<br>DIV3-DIV3</div>
        <div class="item2">DIV1</div>
        <div class="item2">DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2</div>
        <div class="item2">DIV3-DIV3<br>DIV3-DIV3</div>
    </div>
    <h3>flex-wrap<br>align-content: flex-start;</h3>
    <div class="flexBox2 flex-wrap_wrap align-content_flex-start">
        <div class="item2">DIV1</div>
        <div class="item2">DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2</div>
        <div class="item2">DIV3-DIV3<br>DIV3-DIV3</div>
        <div class="item2">DIV1</div>
        <div class="item2">DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2</div>
        <div class="item2">DIV3-DIV3<br>DIV3-DIV3</div>
    </div>
    <h3>flex-wrap<br>align-content: center;</h3>
    <div class="flexBox2 flex-wrap_wrap align-content_center">
        <div class="item2">DIV1</div>
        <div class="item2">DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2</div>
        <div class="item2">DIV3-DIV3<br>DIV3-DIV3</div>
        <div class="item2">DIV1</div>
        <div class="item2">DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2</div>
        <div class="item2">DIV3-DIV3<br>DIV3-DIV3</div>
    </div>
    <h3>flex-wrap<br>align-content: flex-end;</h3>
    <div class="flexBox2 flex-wrap_wrap align-content_flex-end">
        <div class="item2">DIV1</div>
        <div class="item2">DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2</div>
        <div class="item2">DIV3-DIV3<br>DIV3-DIV3</div>
        <div class="item2">DIV1</div>
        <div class="item2">DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2</div>
        <div class="item2">DIV3-DIV3<br>DIV3-DIV3</div>
    </div>
    <h3>flex-wrap<br>align-content: space-around;</h3>
    <div class="flexBox2 flex-wrap_wrap align-content_space-around">
        <div class="item2">DIV1</div>
        <div class="item2">DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2</div>
        <div class="item2">DIV3-DIV3<br>DIV3-DIV3</div>
        <div class="item2">DIV1</div>
        <div class="item2">DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2</div>
        <div class="item2">DIV3-DIV3<br>DIV3-DIV3</div>
    </div>
    <h3>flex-wrap<br>align-content: space-between;</h3>
    <div class="flexBox2 flex-wrap_wrap align-content_space-between">
        <div class="item2">DIV1</div>
        <div class="item2">DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2</div>
        <div class="item2">DIV3-DIV3<br>DIV3-DIV3</div>
        <div class="item2">DIV1</div>
        <div class="item2">DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2<br>DIV2-DIV2-DIV2</div>
        <div class="item2">DIV3-DIV3<br>DIV3-DIV3</div>
    </div>
    <h3>flex-wrap<br>align-content: stretch;<br>children element height - fixPX</h3>
    <div class="flexBox2 flex-wrap_wrap align-content_stretch">
        <div class="item3">DIV1</div>
        <div class="item3">DIV2</div>
        <div class="item3">DIV3</div>
        <div class="item3">DIV4</div>
        <div class="item3">DIV5</div>
        <div class="item3">DIV6</div>
    </div>
    <h3>div in div center align</h3>
    <div class="flexBox3 flex-wrap_wrap justify-content_center align-items_center">
        <div class="item4">DIV</div>
    </div>
</body>
              
            
!

CSS

              
                /*RESET*/
* { margin: 0; padding: 0; }
body { font: 17px 'Nanum Gothic', sans-serif; text-align: center; }
a { text-decoration: none; color: #404040; }
li { list-style: none; }
h3 { border-bottom: 1px solid black; margin-top: 20px; margin-bottom: 5px; }

/*BODY*/
/*base*/
.flexBox {
    display: flex;
    color: #fff;
    text-align: center;
    background: #ff0;
}

.flexBox2 {
    display: flex;
    width: 600px;
    height: 500px;
    margin: 0 auto;
    color: #fff;
    text-align: center;
    background: #ff0;
}

.flexBox3 {
    display: flex;
    width: 600px;
    height: 200px;
    margin: 0 auto;
    color: #fff;
    text-align: center;
    background: #ff0;
}

.item {
    margin: 5px;
    padding: 20px;
    background: #555;
}

.item2 {
    width: 200px;
    margin: 10px auto;
    padding: 10px;
    background: #555;
}

.item3 {
    width: 200px;
    height: 40px;
    margin: 10px auto;
    padding: 10px;
    background: #555;
}

.item4 {
    width: 200px;
    height: 40px;
    padding: 10px;
    background: #555;
}

/* flex Options*/
/* flex-direction */
.flex-direction_row {flex-direction: row; /*default*/}
.flex-direction_row-reverse {flex-direction: row-reverse;}
.flex-direction_column {flex-direction: column;}
.flex-direction_column-reverse {flex-direction: column-reverse;}

/* flex-wrap */
.flex-wrap_nowrap {flex-wrap: nowrap; /*default*/}
.flex-wrap_wrap {flex-wrap: wrap;}
.flex-wrap_wrap-reverse {flex-wrap: wrap-reverse;}

/* justify-content */
.justify-content_flex-start {justify-content: flex-start; /*default*/}
.justify-content_center {justify-content: center;}
.justify-content_flex-end {justify-content: flex-end;}
.justify-content_space-around {justify-content: space-around;}
.justify-content_space-between {justify-content: space-between;}

/* align-items */
.align-items_stretch {align-items: stretch; /*default*/}
.align-items_flex-start {align-items: flex-start;}
.align-items_center {align-items: center;}
.align-items_flex-end {align-items: flex-end;}
.align-items_baseline {align-items: baseline;}

/* align-content */
.align-content_stretch {align-content: stretch; /*default*/}
.align-content_flex-start {align-content: flex-start;}
.align-content_center {align-content: center;}
.align-content_flex-end {align-content: flex-end;}
.align-content_space-around {align-content: space-around;}
.align-content_space-between {align-content: space-between;}

/* flexBox > div.item Options */
/* flex: 1; */
.flex_1 {flex: 1;}

/* flex: auto; */
.flex_auto {flex: auto;}

/* flex: 0 1 random%; */
.flex_0_1_10per {flex: 0 1 10%;}
.flex_0_1_60per {flex: 0 1 60%;}
.flex_0_1_30per {flex: 0 1 30%;}

/* flex: 0 0 randomPX; */
.flex_0_0_50px {flex: 0 0 50px;}
.flex_0_0_100px {flex: 0 0 100px;}
.flex_0_0_200px {flex: 0 0 200px;}
.flex_0_0_300px {flex: 0 0 300px;}
.flex_0_0_500px {flex: 0 0 500px;}

/* order */
.order_1 {order: 1}
.order_2 {order: 2}
.order_3 {order: 3}
              
            
!

JS

              
                
              
            
!
999px

Console