Last updated: 6 march 2025

Tailwind Align Items

Learn how to use Tailwind CSS align items classes to control vertical alignment in flex layouts. This beginner-friendly guide covers the full Tailwind align items list with examples, responsive tips, and best practices.


Tailwind Align Items

In CSS Flexbox, the align-items property controls how flex items are vertically aligned inside a flex container along the cross-axis (which is usually vertical).

Tailwind CSS makes this super easy with its utility-first approach. Instead of writing custom CSS, you can simply add an items-{alignment} class to your container.

How to Apply Tailwind Align Items

To apply alignment, add the appropriate items-{alignment} class to your flex container. Here's the basic syntax:

html
<div class="flex items-center">
<!-- Flex items here -->
</div>

Notice: You must set the container to flex using the flex class. Without it, items-center and similar utilities won't have any effect.

Tailwind Align Items List (Quick Reference)

Here's a handy Tailwind align items list with all the available options:

ClassPropertiesWhat it does
items-startalign-items: flex-startAligns items to the start (top);
items-endalign-items: flex-endAligns items to the end (bottom);
items-centeralign-items: centerCenters items vertically;
items-baselinealign-items: baselineAligns items based on their text baselines;
items-stretchalign-items: stretchStretches items to fill container height;

You'll find yourself using items-center and items-start most often, but knowing all of them gives you great control over your layouts!

Tailwind Align Items Examples

Let's dive into some simple examples to see how each alignment looks in action

Example 1: Center Items Vertically

html
<div class="flex items-center">
<div class="bg-blue-500 h-8 w-8">Items 1</div>
<div class="bg-blue-500 h-4 w-4">Items 2</div>
<div class="bg-blue-500 h-6 w-6">Items 3</div>
</div>

Preview

Item 1

items 2

items 3

Example 2: Responsive Tailwind Align Items

Tailwind CSS allows you to apply align items classes responsively at different breakpoints. To use responsive tailwind align items classes, you can append the breakpoint prefix to the utility class. For example, md:items-center applies the center alignment starting from the medium breakpoint and above.

html
<div class="flex items-start md:items-center">
<!-- Flex items here -->
</div>

In the above example, the flex items are aligned to the start of the cross-axis by default (items-start), but starting from the medium breakpoint and above, the alignment is changed to center (items-center).

Understanding Each Align Items Option (Detailed)

1. items-start

Aligns flex items to the start of the container's cross-axis (top for a column layout).

Useful for:

  • Aligning multiple headers at the top.

  • Keeping icons aligned in a sidebar.

2. items-end

Aligns items to the end (bottom).

Useful for:

  • Aligning a call-to-action button at the bottom of a card.

  • Creating a sticky footer inside a container.

3. items-center

Centers items along the cross-axis.

Useful for:

  • Centering logos in a navbar.

  • Centering profile pictures inside cards.

4. items-baseline

Aligns flex items along their text baselines.

Useful for:

  • Aligning headings and paragraphs neatly.

  • Aligning icons next to text precisely.

5. items-stretch

Default behavior — stretches flex items to fill the height of the container if no height is set.

Useful for:

  • Making column grids look consistent.

  • Stretching cards evenly even with different content lengths.

Pro Tips for Using Tailwind Align Items

  • Always combine flex with items-{alignment}. Otherwise, it won't work.

  • Use responsive prefixes (sm:, md:, lg:) to adapt your alignment to different devices.

  • Combine with justify-{alignment} classes to control horizontal alignment too!

  • If your items look weird, check their individual heights — flex alignment works relative to the sizes of your flex children.

  • Play with gap-{size} utilities to add spacing between items without messing up their alignment.

Common Mistakes Beginners Make

  • Forgetting the flex container: You must add flex to the parent element.

  • Mixing up flex-direction: Remember, if you use flex-col, the cross-axis becomes horizontal!

  • Overusing center alignment: While centering is useful, aligning content meaningfully can sometimes offer better design structure.

Quick Cheatsheet: Tailwind Align Items List

✅ items-start → Align to top ✅ items-end → Align to bottom ✅ items-center → Align to center ✅ items-baseline → Align to text baseline ✅ items-stretch → Stretch items to fill

Windframe Tailwind blocks

header

Windframe is a drag and drop builder for rapidly building tailwind css websites and UIs

Start building stunning tailwind UIs! 

Build from scratch or select prebuilt tailwind templates