Below is the HTML structure that I am working with:
<div id="body">
<div id="head">
<p>Dynamic height without scrollbar</p>
</div>
<div id="content">
<p>Dynamic height with scrollbar</p>
</div>
<div id="foot">
<p>Fixed height without scrollbar</p>
</div>
</div>
The goal is to keep all three parts inside the main part (#body) without overflowing. To achieve this, a scroll bar should be present in the middle section.
I attempted different CSS options like below:
#content{
border: red solid 1px;
overflow-y: auto;
}
And also tried this:
#content{
border: red solid 1px;
overflow-y: auto;
height: 100%;
}
However, none of these solutions seem to work as intended.
An example demonstration can be found on JSFiddle.
Is it possible to achieve this using only CSS and HTML? Ideally, I would like to avoid involving Javascript if possible.