<div class="caption">justify-content: flex-start; (default)</div>
<div class="flex-container-start">
<div>
<p>1</p>
</div>
<div>
<p>2</p>
</div>
<div>
<p>3</p>
</div>
<div>
<p>4</p>
</div>
<div>
<p>5</p>
</div>
<div>
<p>6</p>
</div>
<div>
<p>7</p>
</div>
<div>
<p>8</p>
</div>
</div>
<div class="caption">justify-content: flex-end;</div>
<div class="flex-container-end">
<div>
<p>1</p>
</div>
<div>
<p>2</p>
</div>
<div>
<p>3</p>
</div>
<div>
<p>4</p>
</div>
<div>
<p>5</p>
</div>
<div>
<p>6</p>
</div>
<div>
<p>7</p>
</div>
<div>
<p>8</p>
</div>
</div>
<div class="caption">justify-content: center;</div>
<div class="flex-container-center">
<div>
<p>1</p>
</div>
<div>
<p>2</p>
</div>
<div>
<p>3</p>
</div>
<div>
<p>4</p>
</div>
<div>
<p>5</p>
</div>
<div>
<p>6</p>
</div>
<div>
<p>7</p>
</div>
<div>
<p>8</p>
</div>
</div>
.flex-container-start,
.flex-container-end,
.flex-container-center {
display: flex;
background-color: lighten(darkorange, 20%);
border: 1px solid black;
margin-left: auto;
margin-right: auto;
margin-bottom: 10px;
& div {
border: 1px solid black;
width: 48px;
height: 48px;
background-color: darkorange;
margin: 5px;
}
p {
text-align: center;
}
}
.flex-container-start {
justify-content: flex-start;
}
.flex-container-end {
justify-content: flex-end;
}
.flex-container-center {
justify-content: center;
}
.caption {
text-align: center;
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.