justify-content

by rootjang

HTML

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    .wrapper {
      width: 500px;
      height: 50px;
      margin: 0 auto 20px;
      display: flex;
      border: 2px solid black;
    }
    #container1 {
      justify-content: flex-start;
    }
    #container2 {
      justify-content: flex-end;
    }
    #container3 {
      justify-content: center;
    }
    #container4 {
      justify-content: space-between;
    }
    #container5 {
      justify-content: space-around;
    }
    .wrapper div {
      width: 100px;
      border: 2px solid black;
      background: #ccc;
    }
    h1 {
      text-align: center;
    }
    p {
      font-weight:bold;
			text-align:center;
    }
  </style>
</head>
<body>
  <h1>justify-content : flex-start (기본값)</h1>
	<div id="container1" class="wrapper">
		<div><p>1</p></div>
		<div><p>2</p></div>
		<div><p>3</p></div>
	</div>
	<h1>justify-content : flex-end</h1>
	<div id="container2" class="wrapper">
		<div><p>1</p></div>
		<div><p>2</p></div>
		<div><p>3</p></div>
	</div>
	<h1>justify-content : center</h1>
	<div id="container3" class="wrapper">
		<div><p>1</p></div>
		<div><p>2</p></div>
		<div><p>3</p></div>
	</div>
	<h1>justify-content : space-between</h1>
	<div id="container4" class="wrapper">
		<div><p>1</p></div>
		<div><p>2</p></div>
		<div><p>3</p></div>
	</div>
	<h1>justify-content : space-around</h1>
	<div id="container5" class="wrapper">
		<div><p>1</p></div>
		<div><p>2</p></div>
		<div><p>3</p></div>
	</div>
</body>
</html>