-1

How can I space-between two divs vertically using flexbox? Everything works when using it for the horizontal patterns, but not for the vertical ones.

#container {
  height: 50vh;
  width: 15vw;
  background-color: lightblue;
  justify-content: space-between;
}

.item {}
<div id="container">
  <div class="item">
    <p>Align Top</p>
  </div>
  <div class="item">
    <p>Align Bottom</p>
  </div>
</div>
Ori Drori
  • 183,571
  • 29
  • 224
  • 209
JSRB
  • 2,492
  • 1
  • 17
  • 48

1 Answers1

1

Set the display of #container to flex, and set flex-direction: column;:

#container {
  display: flex;
  flex-direction: column;
  height: 50vh;
  width: 15vw;
  background-color: lightblue;
  justify-content: space-between;
}
<div id="container">
  <div class="item">
    <p>Align Top</p>
  </div>
  <div class="item">
    <p>Align Bottom</p>
  </div>
</div>
Ori Drori
  • 183,571
  • 29
  • 224
  • 209