<h1>row(デフォルト)</h1>
<div class="container container-row">
    <div class="item">1</div>
    <div class="item">2</div>
    <div class="item">3</div>
    <div class="item">4</div>
</div>

<h1>row-reverse</h1>
<div class="container container-row-reverse">
    <div class="item">1</div>
    <div class="item">2</div>
    <div class="item">3</div>
    <div class="item">4</div>
</div>

<h1>column</h1>
<div class="container container-column">
    <div class="item">1</div>
    <div class="item">2</div>
    <div class="item">3</div>
    <div class="item">4</div>
</div>

<h1>column-reverse</h1>
<div class="container container-column-reverse">
    <div class="item">1</div>
    <div class="item">2</div>
    <div class="item">3</div>
    <div class="item">4</div>
</div>
.container {
    display: flex;
}

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

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

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

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

.item {
    width: 50px;
    height: 50px;
}

.item:nth-child(1) {
    background-color: #fff001;
}

.item:nth-child(2) {
    background-color: #00a5e7;
}

.item:nth-child(3) {
    background-color: #00984b;
}

.item:nth-child(4) {
    background-color: #cd5638;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.