rafaelcb21 rafaelcb21 - 10 days ago 5
CSS Question

How to position elements with flex

How could it be possible use Flex css to leave the elements as follows?

enter image description here


You can use margin-left: auto on second element and that will push second and third element to right.

.content {
  display: flex;
.content > div {
  width: 50px;
  height: 50px;
  border: 1px solid black;
.content > div:nth-child(2) {
  margin-left: auto;
<div class="content">
  <div class="box">1</div>
  <div class="box">2</div>
  <div class="box">3</div>