Use the align-self Property

Tell us what’s happening:

Can someone explain to me whether the default direction for flex is column ?

Because in a previous exercise the display: flex created a horizontal flexbox.

I want to understand why the boxes in this exercise were not aligned horizonally,

thanks.

My code so far


<style>
  #box-container {
    display: flex;
    height: 500px;
  }
  #box-1 {
    background-color: dodgerblue;
    align-self: center;
    height: 200px;
    width: 200px;
  }

  #box-2 {
    background-color: orangered;
    align-self: flex-end;
    height: 200px;
    width: 200px;
  }
</style>

<div id="box-container">
  <div id="box-1"></div>
  <div id="box-2"></div>
</div>

No it’s not. It’s row.

align- properties move elements across main flex axis. So in this case flex is row and therefore first element will be centered vertically and the second will go to the bottom (flex-end, but across main - row - axis).

Maybe not the best explanation, but that’s how I remember it.

If the flex is row, should the box move up-down or left-right?

align will move across” - so up-down.

1 Like

thanks that reply with the bold a helps …