To create a sticky footer using Bootstrap 5, you can utilize the utility classes and flexbox layout. This ensures that the footer stays at the bottom of the viewport when the content is not tall enough to fill the page.
<!-- BEGIN COPY / PASTE -->
<div class="d-flex flex-column min-vh-100">
<main class="flex-fill">
<!-- Your main content here -->
</main>
<footer class="bg-light text-center py-3 mt-auto">
<!-- Footer content here -->
© 2023 Your Company
</footer>
</div>
<!-- END COPY / PASTE -->
Additional Comment:- The `d-flex` and `flex-column` classes create a flexbox container with a column direction.
- `min-vh-100` ensures the container takes at least the full height of the viewport.
- `flex-fill` makes the main content area expand to fill the available space.
- `mt-auto` on the footer pushes it to the bottom when the content is not enough to fill the page.
✅ Answered with Bootstrap 5 best practices.