Last updated: 2 May 2024

Tailwind Align Items

The tailwind align-items utility class allows you to control the vertical alignment of flex items within a flex container.


Tailwind Align Items

The tailwind align-items utility class allows you to control the vertical alignment of flex items within a flex container. With Tailwind align items class, you can easily adjust the positioning of flex items along the cross-axis.

Applying Align Items

To apply the alignment to a flex container, you can use the items-{alignment} utility class, where {alignment} represents the desired alignment. Here are the available alignment options:

  • items-start: Aligns flex items to the start of the cross-axis.
  • items-end: Aligns flex items to the end of the cross-axis.
  • items-center: Aligns flex items to the center of the cross-axis. -items-baseline: Aligns flex items to the baseline of the cross-axis.
  • items-stretch: Stretches flex items to fill the cross-axis.
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

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).

Tailwind Align Items Class Table

ClassProperties
items - startalign-items: flex-start;
items - endalign-items: flex-end;
items - centeralign-items: center;
items - baselinealign-items: baseline;
items - stretchalign-items: stretch;

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