1<div class="d-flex justify-content-start">...</div>
2<div class="d-flex justify-content-end">...</div>
3<div class="d-flex justify-content-center">...</div>
4<div class="d-flex justify-content-between">...</div>
5<div class="d-flex justify-content-around">...</div>
1/* Positional alignment */
2justify-content: center; /* Pack items around the center */
3justify-content: start; /* Pack items from the start */
4justify-content: end; /* Pack items from the end */
5justify-content: flex-start; /* Pack flex items from the start */
6justify-content: flex-end; /* Pack flex items from the end */
7justify-content: left; /* Pack items from the left */
8justify-content: right; /* Pack items from the right */
9
10/* Baseline alignment */
11/* justify-content does not take baseline values */
12
13/* Normal alignment */
14justify-content: normal;
15
16/* Distributed alignment */
17justify-content: space-between; /* Distribute items evenly
18 The first item is flush with the start,
19 the last is flush with the end */
20justify-content: space-around; /* Distribute items evenly
21 Items have a half-size space
22 on either end */
23justify-content: space-evenly; /* Distribute items evenly
24 Items have equal space around them */
25justify-content: stretch; /* Distribute items evenly
26 Stretch 'auto'-sized items to fit
27 the container */
28
29/* Overflow alignment */
30justify-content: safe center;
31justify-content: unsafe center;
32
33/* Global values */
34justify-content: inherit;
35justify-content: initial;
36justify-content: unset;
37
1/* Positional alignment */
2justify-content: center; /* Pack items around the center */
3justify-content: start; /* Pack items from the start */
4justify-content: end; /* Pack items from the end */
5justify-content: flex-start; /* Pack flex items from the start */
6justify-content: flex-end; /* Pack flex items from the end */
7justify-content: left; /* Pack items from the left */
8justify-content: right; /* Pack items from the right */
9
10/* Baseline alignment */
11/* justify-content does not take baseline values */
12
13/* Normal alignment */
14justify-content: normal;
15
16/* Distributed alignment */
17justify-content: space-between; /* Distribute items evenly
18 The first item is flush with the start,
19 the last is flush with the end */
20justify-content: space-around; /* Distribute items evenly
21 Items have a half-size space
22 on either end */
23justify-content: space-evenly; /* Distribute items evenly
24 Items have equal space around them */
25justify-content: stretch; /* Distribute items evenly
26 Stretch 'auto'-sized items to fit
27 the container */
28
29/* Overflow alignment */
30justify-content: safe center;
31justify-content: unsafe center;
32
33/* Global values */
34justify-content: inherit;
35justify-content: initial;
36justify-content: unset;
1<!DOCTYPE html>
2<html>
3<head>
4 <style>
5 .flex-container{
6 display: flex;
7 justify-content: center;
8 background: coral;
9 }
10 .flex-item{
11 width: 100px;
12 height: 100px;
13 margin: 10px;
14 text-align: center;
15 line-height: 100px;
16 font-size: 25px;
17 background: white;
18 }
19 </style>
20</head>
21<body>
22 <h1>CSS justify-content Property</h1>
23 <h2>justify-content: center</h2>
24 <div class="flex-container">
25 <div class="flex-item">1</div>
26 <div class="flex-item">2</div>
27 <div class="flex-item">3</div>
28 </div>
29
30 <p><b>Note: </b>Notice that the flex items are aligned in the center of the flex container.</p>
31</body>
32</html>