Ask any question about Tailwind CSS here... and get an instant response.
How can I use Tailwind to create a sticky footer layout?
Asked on Nov 11, 2025
Answer
To create a sticky footer layout using Tailwind CSS, you can utilize the utility classes for flexbox and spacing to ensure the footer remains at the bottom of the page. This involves using flex utilities to make the main content area expand and push the footer down.
<!-- 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">Footer</p>
</footer>
</div>
<!-- END COPY / PASTE -->Additional Comment:
- The "flex" and "flex-col" classes create a vertical flex container.
- "min-h-screen" ensures the container takes at least the full height of the viewport.
- "flex-grow" on the main content allows it to expand and push the footer to the bottom.
- Ensure the footer is outside the main content area to remain sticky at the bottom.
Recommended Links:
