0

I have created a menu-bar and it has been set to flexbox. However, I am trying to make my burger area to the extreme right. I am using align-self: flex-end and it is not working. Am I missing anything?

Here is my html: -

<div class="nav-container">
    <h3>DAY/NIGHT</h6>
    <div class="burger-container">
        <div class="burger"></div>
        <div class="burger"></div>
        <div class="burger"></div>
    </div>
</div>

Sass code: -

.nav-container {
  width: 100vw;
  box-sizing: border-box;
  padding: 30px $padding-item-position;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 2;
  background: $dark-mode-menu;
  display: flex;
  flex-direction: row;

  h3 {
    margin: 0;
    font-size: 40px;
    line-height: 30px;
  }

  .burger-container {
    height: 34px;
    width: 34px;
    background: red;
    align-self: flex-end;
  }
}
killerprince182
  • 455
  • 2
  • 12

1 Answers1

1

I took your code and was able to achieve the result with two different options:

margin-left

.burger-container {
  height: 34px;
  width: 34px;
  background: red;
  margin-left: auto;
}

flex-direction: column

.nav-container {
  flex-direction: column;
  // Other css directives

If your flex direction is row, then flex-end would send it to the last row, afaik. flex direction column sends it to the last column. Otherwise, margin-left will always autofill the left side margin and push it "right"

DanielC
  • 921
  • 7
  • 12