Place Self
A shorthand utility that sets both align-self and justify-self properties at once. This allows for positioning an individual grid or flex item within its grid area or flex line, overriding the container's place-items settings. Place-self is perfect for creating exceptions to the overall alignment pattern without needing separate utilities for each axis. In Tailwind v4, place-self utilities have better RTL language support and improved compatibility with other layout properties.
<div class="grid grid-cols-3 gap-4 place-items-start h-64 bg-gray-100 p-4 rounded-lg">
<div class="bg-blue-100 p-4 rounded">Start (default)</div>
<div class="place-self-center bg-blue-300 p-4 rounded">Centered</div>
<div class="place-self-end bg-blue-500 p-4 rounded text-white">End</div>
<div class="place-self-stretch bg-blue-200 p-4 rounded">Stretch</div>
<div class="bg-blue-400 p-4 rounded">Start (default)</div>
<div class="bg-blue-600 p-4 rounded text-white">Start (default)</div>
</div>
Examples
<div class="grid grid-cols-3 gap-4 place-items-start h-64 bg-gray-100 p-4 rounded-lg">
<div class="bg-blue-100 p-4 rounded">Start (default)</div>
<div class="place-self-center bg-blue-300 p-4 rounded">Centered</div>
<div class="place-self-end bg-blue-500 p-4 rounded text-white">End</div>
<div class="place-self-stretch bg-blue-200 p-4 rounded">Stretch</div>
<div class="bg-blue-400 p-4 rounded">Start (default)</div>
<div class="bg-blue-600 p-4 rounded text-white">Start (default)</div>
</div>
<!-- Product showcase with featured item -->
<div class="grid grid-cols-2 md:grid-cols-3 gap-6 p-6 bg-gray-100 rounded-lg">
<div class="bg-white p-4 rounded-lg shadow-sm">
<div class="aspect-square bg-gray-200 mb-2 rounded"></div>
<h3 class="font-medium">Product 1</h3>
<p class="text-gray-600 text-sm">$29.99</p>
</div>
<div class="place-self-center bg-white p-6 rounded-lg shadow-lg transform md:scale-110 col-span-2 md:col-span-1 row-span-2">
<div class="aspect-square bg-blue-100 mb-3 rounded"></div>
<div class="relative">
<span class="absolute -top-3 -right-3 bg-red-500 text-white text-xs font-bold px-2 py-1 rounded">SALE</span>
<h3 class="font-bold text-lg">Featured Product</h3>
<p class="text-gray-700">Special featured product with discount.</p>
<p class="font-medium text-lg mt-2">$49.99</p>
<button class="mt-3 w-full bg-blue-600 text-white py-2 rounded">Add to Cart</button>
</div>
</div>
<div class="bg-white p-4 rounded-lg shadow-sm">
<div class="aspect-square bg-gray-200 mb-2 rounded"></div>
<h3 class="font-medium">Product 3</h3>
<p class="text-gray-600 text-sm">$34.99</p>
</div>
<div class="bg-white p-4 rounded-lg shadow-sm">
<div class="aspect-square bg-gray-200 mb-2 rounded"></div>
<h3 class="font-medium">Product 4</h3>
<p class="text-gray-600 text-sm">$24.99</p>
</div>
</div>
<!-- Dashboard stats with varied alignments -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 p-4 bg-gray-100 rounded-lg">
<div class="place-self-stretch bg-white p-4 rounded-lg shadow-sm">
<h3 class="font-medium text-gray-500 mb-1">Total Users</h3>
<p class="text-3xl font-bold">12,634</p>
<p class="text-sm text-green-600 mt-2">+12% from last month</p>
</div>
<div class="place-self-center bg-white p-6 rounded-lg shadow-md">
<div class="flex flex-col items-center">
<div class="w-16 h-16 rounded-full bg-purple-100 flex items-center justify-center text-purple-600 mb-3">
<svg class="w-8 h-8" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z" />
</svg>
</div>
<p class="text-xl font-bold">2,845</p>
<p class="text-sm text-gray-600">Active Accounts</p>
</div>
</div>
<div class="place-self-end bg-white p-4 rounded-lg shadow-sm lg:col-span-2">
<div class="flex justify-between items-start">
<div>
<h3 class="font-medium text-gray-500 mb-1">Revenue</h3>
<p class="text-3xl font-bold">$34,252</p>
<p class="text-sm text-red-600 mt-2">-2.5% from last month</p>
</div>
<div class="h-16 w-32 bg-gray-200 rounded"></div>
</div>
</div>
</div>
Live Preview
Try the Place Self utility with different values
Variants
auto: uses the parent's place-items values or default alignment; start: places the item at the start in both dimensions; end: places the item at the end in both dimensions; center: centers the item in both dimensions; stretch: stretches the item to fill its grid area in both dimensions