-1

My goal is to exapand sidebar__container to fill the entire vertible height of the screen. However, it seems to only be expanding to about 30% of the screen height.

enter image description here

I tried to use flex: 1 but that doesn't seem to make it work. Here is my code:

function Sidebar() {
  return (
    <div className="sidebar">
      <div className="sidebar__container">
        <div className="sidebar__optionContainer">
          <Link to="/dashboard">
            <SidebarOption Icon={HomeIcon} text="Dashboard" />
          </Link>
          <h6>Appearance</h6>
          <Link to="/themes">
            <SidebarOption Icon={TokensIcon} text="Themes" />
          </Link>
          <Link to="/themes">
            <SidebarOption Icon={LayersIcon} text="Gallery" />
          </Link>
        </div>
        <div className="sidebar__optionContainer">
          <h1>Help</h1>
        </div>
      </div>
    </div>
  );
}

And here is my css code:


.sidebar__container {
  padding: 0px 20px;
  padding-top: 20px;
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: space-between;
}

Roger Staxx
  • 439
  • 4
  • 12
  • Does this answer your question? [How to make a div 100% height of the browser window](https://stackoverflow.com/questions/1575141/how-to-make-a-div-100-height-of-the-browser-window) – T04435 Nov 26 '20 at 05:43

2 Answers2

2

You can set the height to be 100% of the viewport height:

height: 100vh;
1

You height:100% as you can see here in a sample code. It will automatically extend the height depends the height of your browser.

.wrapper {height:700px;margin:0 auto;padding:0;max-width:1200px;width:100%;}
.height {height:100%;display:block;padding:2rem;text-align:center;width:400px;background:red;}
<div class="wrapper">
<div class="height">
sample
</div>
</div>
laurence keith albano
  • 1,409
  • 4
  • 27
  • 59