Copyright 2025

The Valley of Code

A Flavio Copes project

How to align center vertically using Tailwind
How to align center vertically using Tailwind

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>

Join my AI Workshop !

The Web Development BOOTCAMP cohort starts in February 2026