<h2>Items are starting from the left and stack to the top</h2>
<ul class="flex-container container1">
  <li class="flex-item">1</li>
  <li class="flex-item">2</li>
  <li class="flex-item">3</li>
</ul>
<hr>
<h2 style="text-align: center;">Items are centered</h2>
<ul class="flex-container container2">
  <li class="flex-item">1</li>
  <li class="flex-item">2</li>
  <li class="flex-item">3</li>
</ul>
<hr>
<h2>Items are starting from the right and stack to the bottom</h2>
<ul class="flex-container container3">
  <li class="flex-item">1</li>
  <li class="flex-item">2</li>
  <li class="flex-item">3</li>
</ul>
.flex-container {
	padding: 0;
	margin: 0;
	list-style: none;
	display: -webkit-flex; /* Safari */
	display: flex;
	-webkit-flex-direction: row; /* Safari */
	flex-direction: row;
	-webkit-flex-wrap: nowrap; /* Safari */
	flex-wrap: nowrap;
}
.flex-item {
	background: tomato;
	width: 50px;
	height: 150px;
	margin-top: 10px;
	line-height: 150px;
	color: white;
	font-weight: bold;
	font-size: 3em;
	text-align: center;
}
.container1{
	-webkit-justify-content: flex-start; /* Safari */
	justify-content: flex-start;
	-webkit-align-items: flex-start; /* Safari */
	align-items: flex-start;
	-webkit-align-content: space-between; /* Safari */
	align-content: space-between;
}
.container2{
	-webkit-justify-content: center; /* Safari */
	justify-content: center;
	-webkit-align-items: center; /* Safari */
	align-items: center;
	-webkit-align-content: space-between; /* Safari */
	align-content: space-between;
}
.container3{
	-webkit-align-content: space-between; /* Safari */
	align-content: space-between;
}
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.