-1

Is it possible to add justify-content: space-between only to 2nd and 3rd child of a div? I don't want to make another parent around them, because that will broke my previous style. I need to have structure like this:

.wrapper{
     display: flex;
}
<div class="wrapper">
    <div class="container-1">content 1</div>
    <div class="container-2">content 2</div>
    <!-- add space here -->
    <div class="container-3">content 3</div>
</div>

And my final result needs to look like this:

enter image description here

Maybe using nth child or something like that?

Skar
  • 333
  • 2
  • 11

1 Answers1

2

.wrapper{
     display:flex;
}

.container-3{
     margin-left: auto;
}
<div class="wrapper">
    <div class="container-1">content 1</div>
    <div class="container-2">content 2</div>
    <!-- add space here -->
    <div class="container-3">content 3</div>
</div>

This css will push your container-3 to the right and add available space in between

Skar
  • 333
  • 2
  • 11
Nguyen Thanh
  • 127
  • 2