My issue arises when using a dark background footer, as some pages lack enough content to fill the entire browser's viewport. Consequently, an unsightly white band appears below it.
How can I ensure the footer reaches the bottom of the viewport on pages with minimal content? However, on pages with more content exceeding the viewport size, the footer should only become visible after scrolling past that content.
I've experimented with Bootstrap 5's fixed-bottom
and sticky-bottom
classes, but they tend to hide content in cases where there is either substantial content or a smaller browser viewport.
<html>
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7e1c11110a0d0a0c1f0e3e4b504c504c">[email protected]</a>/dist/css/bootstrap.min.css" integrity="sha256-IUOUHAPazai08QFs7W4MbzTlwEWFo7z/4zw8YmxEiko=" crossorigin="anonymous">
</head>
<body>
<div class="container">
<h1>Title</h1>
<p>Content</p>
</div>
<footer class="bg-black text-white">
<div class="container">
<p>This should be at the bottom of the page</p>
<p>This should be no white band below this</p>
</div>
</footer>
<script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="86e4e9e9f2f5f2f4e7f6c6b3a8b4a8b4">[email protected]</a>/dist/js/bootstrap.bundle.min.js" integrity="sha256-xLI5SjD6DkojxrMIVBNT4ghypv12Xtj7cOa0AgKd6wA=" crossorigin="anonymous"></script>
</body>
</html>