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

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

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

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

<h1>space-around</h1>
<div class="container container-space-around">
    <div class="item">1</div>
    <div class="item">2</div>
    <div class="item">3</div>
    <div class="item">4</div>
</div>
.container {
    width: 400px;
    background-color: #eee;
    display: flex;
}

.container-flex-start {
    justify-content: flex-start;
}

.container-flex-end {
    justify-content: flex-end;
}

.container-center {
    justify-content: center;
}

.container-space-between {
    justify-content: space-between;
}

.container-space-around {
    justify-content: space-around;
}

.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.