<div class="flex h-32 border border-gray-400"> <div class="bg-blue-500 text-white p-2">Item 1</div> <div class="bg-green-500 text-white p-2">Item 2</div> </div>
items-center aligns all flex items along the cross axis (vertical if flex-row). justify-center aligns items along the main axis (horizontal if flex-row). content-center aligns lines of items in multi-line flex containers. self-center aligns a single item, not all.
<div class="flex items-start h-24 border border-gray-400"> <div class="bg-red-500 text-white p-2">A</div> <div class="bg-yellow-500 text-black p-2">B</div> <div class="bg-green-500 text-white p-2">C</div> </div>
items-start controls cross axis alignment.The items-start class aligns all flex items to the start of the cross axis, which is the top when flex direction is row.
<div class="flex items-start h-24 border border-gray-400"> <div class="bg-purple-500 text-white p-2">Item 1</div> <div class="bg-pink-500 text-white p-2">Item 2</div> <div class="bg-indigo-500 text-white p-2">Item 3</div> </div>
self-center aligns a single flex item on the cross axis independently of the container's items-* setting.
items-stretch affect flex items?items-stretch do to the items?<div class="flex items-stretch h-32 border border-gray-400"> <div class="bg-teal-500 text-white p-2">Box 1</div> <div class="bg-orange-500 text-white p-2">Box 2</div> </div>
items-stretch makes flex items grow to fill the container's height (cross axis) if no fixed height is set on the items themselves.
<nav class="flex items-center h-12 bg-gray-100"> <a href="#home" class="px-4">Home</a> <a href="#about" class="px-4">About</a> <a href="#contact" class="px-4">Contact</a> </nav>
Using items-center keeps all navigation links aligned vertically, making keyboard focus easier to follow and screen readers interpret the layout clearly. Misaligned items can confuse users relying on keyboard or assistive tech.