I have made a div that I want to start at 20% from the top, and go to wherever the bottom of the page is. The issue is that the div won't "expand" when there is more content than what the site can display without scrolling. My explanation is bad, but just look at the jsfiddle, and you'll get it :)
JSFiddle: https://jsfiddle.net/rvv7an5h/
.mainContent {
background-color: rgb(220, 220, 220);
height: 100%;
width: 100%;
position: absolute;
top: 20%;
margin: 0 auto;
text-align: center;
}
<div id="mainContent" class="mainContent">
<div id="mainContentText" class="mainContentText">
<h1> guides </h1>
<h2> Here are some guides ya fool.</h2>
</div>
<div id="commonGuides" style="commonGuides">
<h3>Here they are:</h3>
<h3>Here they are:</h3>
<h3>Here they are:</h3>
<h3>Here they are:</h3>
<h3>Comin' up!:</h3>
<h3>Comin' up!:</h3>
<h3>Comin' up!:</h3>
<h3>Comin' up!:</h3>
<h3>Just keep scrolling a little more!</h3>
<h3>Just keep scrolling a little more!</h3>
<h3>Just keep scrolling a little more!</h3>
<h3>Just keep scrolling a little more!</h3>
<h3>Just keep scrolling a little more!</h3>
<h3>Just keep scrolling a little more!</h3>
<h3>Just keep scrolling a little more!</h3>
<h3>ALMOST THERE!</h3>
<h3>ALMOST THERE!</h3>
<h3>ALMOST THERE!</h3>
<h3>ALMOST THERE!</h3>
<h3>ALMOST THERE!</h3>
<h3>The guides were a lie.</h3>
</div>
</div>
Edit: My question is not the same as How to make a div 100% height of the browser window?. The question there was how to make a div's height change when a user resizes their window (at least from my understanding), while what I wanted to do was to make a div as high as the content within it, so that no content would be outside of the div.