Ask any question about Tailwind CSS here... and get an instant response.
Post this Question & Answer:
How can I implement a sticky footer using Tailwind CSS?
Asked on Mar 10, 2026
Answer
To implement a sticky footer using Tailwind CSS, you can use flexbox utilities to ensure the footer stays at the bottom of the page. This involves setting up a container with flex and flex-col classes and using flex-grow to make the main content area take up the remaining space.
<!-- BEGIN COPY / PASTE -->
<div class="min-h-screen flex flex-col">
<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
min-h-screenclass ensures the container takes at least the full height of the viewport. - The
flexandflex-colclasses create a vertical layout. - The
flex-growclass on the main content allows it to expand and fill the available space, pushing the footer to the bottom. - This approach ensures the footer remains at the bottom even if the content is short.
Recommended Links:
