Below is an Html code with bootstrap 4. It has a fixed Header and Footer with scrollable bootstrap Cards in between. While scrolling, some of the Cards hides the Header. How to make the Cards scroll "behind" the Header ?
<header style="position: fixed; left: 0; top: 0; width: 100%;" class="bg-info text-center">header</header>
<br><br>
<div class="container">
<div class="card">
<div class="container"> <h2>My Card</h2> </div>
</div>
<p>simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text </p>
<div class="card">
<div class="container"> <h2>My Card</h2> </div>
</div>
<p>simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text </p>
<div class="card">
<div class="container"> <h2>My Card</h2> </div>
</div>
<p>simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text </p>
<div class="card">
<div class="container"> <h2>My Card</h2> </div>
</div>
<p>simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text </p>
<div class="card">
<div class="container"> <h2>My Card</h2> </div>
</div>
<p>simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text </p>
<div class="card">
<div class="container"> <h2>My Card</h2> </div>
</div>
<p>simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text </p>
<div class="card">
<div class="container"> <h2>My Card</h2> </div>
</div>
<p>simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text </p>
<div class="card">
<div class="container"> <h2>My Card</h2> </div>
</div>
<p>simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text </p>
<div class="card">
<div class="container"> <h2>My Card</h2> </div>
</div>
<p>simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text </p>
<div class="card">
<div class="container"> <h2>My Card</h2> </div>
</div>
<p>simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text </p>
<div class="card">
<div class="container"> <h2>My Card</h2> </div>
</div>
<p>simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text </p>
</div>
<p>simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text </p>
</div>
<div class="card">
<div class="container"> <h2>My Card</h2> </div>
</div>
<p>simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text simple text </p>
</div>
<footer style="position: fixed; left:0; bottom:0; width:100%;" class="bg-info text-center">footer</footer>
You are not using the bootstrap in a proper way. For header and footer use
nav
bar which is provided by bootstrap instead ofheader
andfooter
.For Fixed header:-
For Fixed Footer:-
Reference:-
https://getbootstrap.com/docs/4.0/components/navbar/#placement