Home > Blockchain >  Why is the <div> element not filling the rest of the screen wen I use height: 100%;
Why is the <div> element not filling the rest of the screen wen I use height: 100%;

Time:11-11

I am making a sidebar for my site and I want the side bar to fill the rest of the screen but also scroll separate to the right of the screen when it overflows with other elements inside. When I use 100% for the height the element only goes to the height of the last element inside of it.

I am trying to get it to fill the rest of the screen as I stated previously but it only goes to not all the way.

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
}

.main {
  margin-left: 345px;
  border: 0px solid #ffffff;
  padding: 0px 0px;
  flex-direction: column;
  align-content: center;
  text-align: center;
  width: 450px;
}

.card {
  display: inline-block;
  width: 400px;
  height: 160px;
  background-color: #404040;
  border: 1px solid #404040;
  border-radius: 4px;
  margin: 0px;
  margin-top: 20px;
  text-decoration: none;
}

.toptext {
  display: inline-block;
  width: 400px;
  height: 45px;
  color: #ffffff;
  background-color: #ffffff;
  border: 1px solid #ffffff;
  border-radius: 4px;
  margin: 0px;
  margin-top: 5px;
  text-decoration: none;
  text-align: left;
}

.toptext h1 {
  font-size: 20px;
  margin-left: 0px;
  margin-top: 1px;
  color: #404040;
}

.toptext p {
  font-size: 12px;
  margin-left: 0px;
  margin-top: -10px;
  color: #404040;
}

.flexcolumn {
  flex-direction: column;
}

.leftmain {
  height: 100%;
  width: 325px;
  padding: 0px 10px;
  flex-direction: column;
  align-content: center;
  background-color: #333333;
  overflow: scroll;
}

.leftmain p {
  float: left;
  color: #ffffff;
  text-align: left;
  padding: 0px 10px;
  text-decoration: none;
  font-size: 12px;
  line-height: 25px;
  border-radius: 4px;
  background-color: #333333;
  width: 300px;
}

.leftmain p:hover {
  background-color: #404040;
  color: #ffffff;
}

.header {
  overflow: hidden;
  background-color: #404040;
  padding: 10px 10px;
  height: 36px;
  text-align: center;
}

.header-right {
  float: right;
  padding: 0px 0px;
}

.header a {
  float: left;
  color: #ffffff;
  text-align: center;
  padding: 5px 10px;
  text-decoration: none;
  font-size: 18px;
  line-height: 25px;
  border-radius: 4px;
  align-content: center;
}

.header a:hover {
  background-color: #333333;
  color: #ffffff;
}
<div >
  <a href="#test" id="nameOfCompany">           
  • Related