I have a sidebar with three interior div's like so:
<div class="sidebar">
<div class="top">
<h3>Title</h3>
<img src="somesource.jpg" alt="The size of this can change" />
</div>
<div class="middle">
<!-- there is an unknown amount of content here represented below coming from a server -->
<h2>There may be very few of these or a lot of them</h2>
<p>see the heading also in this div</p>
</div>
<div class="bottom">
<button>This is a button for navigation only visible in the sidebar</button>
</div>
</div>
I have css for them shown below:
.sidebar {
position:fixed;
height: calc(100% - 67px); /* height of the window - height of the header */
width: 20%;
bottom: 0px;
right: 20px;
}
.bottom {
height: 100px;
}
What css do I need to add to make .top take up the space it needs, .bottom stick to the bottom of .sidebar, and .middle take up all the remaining space and scroll if necessary? Currently, using javascript isn't an option as I have been given direct instruction by my boss to do this without javascript.
EDIT:
I can now use javascript and I have it working by calculating the height of .top and subtracting that and the height of .bottom from 100% and setting bottom for .middle to the height of .bottom.