<div class="flex-container">
    <div class="item">1</div>
    <div class="item">2</div>
    <div class="item">3</div>
    <div class="item">4</div>
</div>
.flex-container {
    display: flex; /* 플렉스 컨테이너 생성 */
    border: 4px solid silver;
    flex-direction: row; /* 주축(main axis, 기본 축)을 결정 */
    justify-content: /* value <= 라이브 데모에서 동적으로 구현 */
}
.item { /* 플렉스 아이템 */
     border: 4px solid blue;
     background-color: yellow;
}
/*
 * 일부 스타일 코드는 가독성을 위해 생략했습니다!
*/
CSS 데모: justify-content 데모 버튼을 클릭해 보세요!
selector {
    justify-content: flex-start | flex-end | center | space-between | space-around
}
/* 키워드 값 */
justify-content: flex-start;
justify-content: flex-end;
justify-content: center;
justify-content: space-between;
justify-content: space-around;

/* 글로벌 값 */
justify-content: inherit;
justify-content: initial;
justify-content: revert;
justify-content: revert-layer;
justify-content: unset;
CSS flexbox justify-content의 5가지 값(flex-start, flex-end, center, space-between, space-around) 비교
flexbox의 justify-content 속성에 대한 값과 그 효과를 보여주는 그림입니다.
<div class="flex-container">
    <div class="item">1</div>
    <div class="item">2</div>
    <div class="item">3</div>
    <div class="item">4</div>
</div>
.flex-container {
    display: flex; /* 플렉스 컨테이너 생성 */
    border: 4px solid silver;
    flex-direction: column; /* 주축(main axis, 기본 축)을 결정 */
    justify-content: /* value <= 라이브 데모에서 동적으로 구현 */
}
.item { /* 플렉스 아이템 */
     border: 4px solid blue;
     background-color: yellow;
}
/*
 * 일부 스타일 코드는 가독성을 위해 생략했습니다!
*/
CSS 데모: flex-direction: columnjustify-content 데모 버튼을 클릭해 보세요!
<nav>
    <ul>
        <li><a href="">제품 보기</a></li>
        <li><a href="">개인정보처리방침</a></li>
        <li><a href="">고객센터</a></li>
    </ul>
</nav>
ul {
    display: flex;
    justify-content: center;
    margin: 0;
    padding: 1em;
    background-color: #e3f2fd;
}
li {
    list-style: none;
}
a {
    color: inherit;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}
li:not(:first-child)::before {
    content: "";
    display: inline-block;
    width: 1px;
    height: 0.8em;
    background-color: rgba(0, 0, 0, .6);
    margin: 0 1em;
    vertical-align: -0.06em;
    white-space: nowrap;
}
실제 적용된 모습
<header class="site-header">
    <div class="logo">
        <a href="">Your Logo</a>
    </div>
    <div class="user-actions">
        <a href="">로그인</a>
        <a href="" class="btn-signup">회원가입</a>
    </div>
</header>
.site-header {
    display: flex;
    /* 로고와 사용자 액션 버튼을 양쪽 끝으로 배치 */
    justify-content: space-between;
    /* 세로 축의 중앙에 배치하여 수직 정렬을 맞춤 */
    align-items: center;
    padding: 1em 2em;
    background-color: #e3f2fd;
}
.logo a {
    font-weight: bold;
    color: #1976d2;
    text-decoration: none;
}
.user-actions a {
    margin-left: 1.5em;
    color: #666;
    text-decoration: none;
    font-size: 0.9em;
}
.user-actions .btn-signup {
    padding: 0.5em 1em;
    background-color: #1976d2;
    color: #fff;
    border-radius: 4px;
}
실제 적용된 모습