rafaelcb21 rafaelcb21 - 1 year ago 88
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

Answer Source

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>

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download