Ask any question about Tailwind CSS here... and get an instant response.
Post this Question & Answer:
How can I create a sticky footer using Tailwind CSS?
Asked on May 20, 2026
Answer
To create a sticky footer using Tailwind CSS, you can utilize flexbox utilities to ensure the footer remains at the bottom of the viewport when the content is not enough to fill the page. This involves setting up a flex container that takes the full height of the screen and using flex-grow to push the footer to the bottom.
<!-- BEGIN COPY / PASTE -->
<div class="flex flex-col min-h-screen">
<header class="bg-blue-500 p-4">
<h1 class="text-white">Header</h1>
</header>
<main class="flex-grow p-4">
<p>Main content goes here.</p>
</main>
<footer class="bg-gray-800 p-4">
<p class="text-white">Sticky Footer</p>
</footer>
</div>
<!-- END COPY / PASTE -->Additional Comment:
- The
flexandflex-colclasses create a vertical flex container. - The
min-h-screenclass ensures the container takes at least the full height of the viewport. - The
flex-growclass on the main content allows it to expand and push the footer to the bottom. - Adjust padding and background colors as needed for your design.
Recommended Links:
