How to align center vertically using Tailwind
New Courses Coming Soon
Join the waiting lists
I always tend to forget how to align center vertically using Flexbox.
You need a container with those CSS instructions:
display: flex;
align-items: center;
justify-content: center;
In Tailwind, this translates to the classes flex items-center justify-center
.
Example:
<div class='flex items-center justify-center'>
<button>Add</button>
</div>
→ Get my CSS Handbook
→ Read my CSS Tutorial on
The Valley of Code
Here is how can I help you:
- COURSES where I teach everything I know
- CODING BOOTCAMP cohort course - next edition in 2025
- THE VALLEY OF CODE your web development manual
- BOOKS 17 coding ebooks you can download for free on JS Python C PHP and lots more
- Interesting links collection
- Follow me on X