Currently, I am utilizing Bootstrap 4, specifically alpha-6 version.
Here's the scenario I'm dealing with:
<body>
<!-- A div is automatically generated within a randomly assigned ID and class -->
<div class="bigone">
<div class="container-fluid">
<div class="header">
My header
</div>
</div>
<div class="mybar">
Navigation bar
</div>
<div class="main">
<div class="container-fluid">
<div class="row">
<div class="col-6">
<div class="card">
<div class="card-header">
Card Header
</div>
<div class="list-group list-group-flush">
<a href="#" class="list-group-item list-group-item-action"><b>FIRST LINK</b></a>
<a href="#" class="list-group-item list-group-item-action">Dapibus ac facilisis in</a>
<a href="#" class="list-group-item list-group-item-action">Dapibus ac facilisis in</a>
<a href="#" class="list-group-item list-group-item-action">Morbi leo risus</a>
<a href="#" class="list-group-item list-group-item-action disabled"><b>LAST LINK</b></a>
</div>
<div class="card-footer">
Card Footer
</div>
</div>
</div>
<div class="col-6">
<h1>FIRST LINE</h1> So many words, so many words. So many words, so many words. So many words, so many words.
<br> So many words, so many words. So many words, so many words. So many words, so many words.
<br> So many words, so many words. So many words, so many words. So many words, so many words.
<br>
<h1>LAST LINE</h1>
</div>
</div>
</div>
</div>
<div class="footer">
Footer
</div>
</div>
<!-- Closing previously mentioned div -->
</body>
The following is the css code snippet:
.bigone {
display: flex;
min-height: 100vh;
flex-direction: column;
}
.main {
flex: 1;
}
Feel free to check out the DEMO on plnkr: https://plnkr.co/edit/Q9PQIj8uDFY80bxJGks3
To ensure that footer stays at the bottom when the page content is empty, I have set: .bigone { height: 100vh; }
and utilized Bootstrap Flexbox align utilities like:
<div class="bigone d-flex flex-column">
Now, my aim is to make both the list-group
in card
and the col-6
section containing "so many words" scrollable, so their heights extend up to the bottom where the footer is located.
In essence, I do not want the main BODY to have a scrollbar present.
Note that the heights of my header and footer are subject to change and are not fixed values.
How can this be achieved? As I am not an expert in using flexbox properties.
I should note that compatibility with Internet Explorer is not necessary, Chrome support is sufficient.
IMPORTANT:
I am unable to fix the height of my card by employing something similar to the following:
height: calc(100vh - header.height - footer.height - etc...);
This limitation arises from the dynamic nature of changing heights for elements such as header, footer, etc.
Visual representation of the issue: