This class accepts two values in tailwind CSS. It is the alternative to the CSS justify-items property. This class is used for controlling how grid items are aligned along their inline axis.
Justify Items:
- justify-items-auto
- justify-items-start
- justify-items-end
- justify-items-center
- justify-items-stretch
justify-items-auto: This class is used to justify grid items automatically on their inline axis.
Syntax:
<element class="justify-items-auto">...</element>
Example:
HTML
<!DOCTYPE html>
< head >
< link href =
rel = "stylesheet" >
</ head >
< body class = "text-center" >
< h1 class = "text-green-600 text-5xl font-bold" >
GeeksforGeeks
</ h1 >
< b >Tailwind CSS Justify Items Class</ b >
< div id = "main" class = "grid justify-items-auto grid-cols-2" >
< div class = "bg-green-500 rounded-lg m-4 h-12" >1</ div >
< div class = "bg-green-500 rounded-lg m-4 h-12" >2</ div >
< div class = "bg-green-500 rounded-lg m-4 h-12" >3</ div >
< div class = "bg-green-500 rounded-lg m-4 h-12" >4</ div >
< div class = "bg-green-500 rounded-lg m-4 h-12" >5</ div >
< div class = "bg-green-500 rounded-lg m-4 h-12" >6</ div >
</ div >
</ body >
</ html >
|
Output:

justify-items-start: This class is used to justify grid items against the start of their inline axis.
Syntax:
<element class="justify-items-start">...</element>
Example:
HTML
<!DOCTYPE html>
< head >
< link href =
rel = "stylesheet" >
</ head >
< body class = "text-center" >
< h1 class = "text-green-600 text-5xl font-bold" >
GeeksforGeeks
</ h1 >
< b >Tailwind CSS Justify Items Class</ b >
< div id = "main" class = "grid justify-items-start grid-cols-2" >
< div class = "bg-green-500 rounded-lg m-4 w-20 h-12" >1</ div >
< div class = "bg-green-500 rounded-lg m-4 w-20 h-12" >2</ div >
< div class = "bg-green-500 rounded-lg m-4 w-20 h-12" >3</ div >
< div class = "bg-green-500 rounded-lg m-4 w-20 h-12" >4</ div >
< div class = "bg-green-500 rounded-lg m-4 w-20 h-12" >5</ div >
< div class = "bg-green-500 rounded-lg m-4 w-20 h-12" >6</ div >
</ div >
</ body >
</ html >
|
Output:

justify-items-end: This class is used to justify grid items against the end of their inline axis.
Syntax:
<element class="justify-items-end">...</element>
Example:
HTML
<!DOCTYPE html>
< head >
< link href =
rel = "stylesheet" >
</ head >
< body class = "text-center" >
< h1 class = "text-green-600 text-5xl font-bold" >
GeeksforGeeks
</ h1 >
< b >Tailwind CSS Justify Items Class</ b >
< div id = "main" class = "grid justify-items-end grid-cols-2" >
< div class = "bg-green-500 rounded-lg m-4 w-20 h-12" >1</ div >
< div class = "bg-green-500 rounded-lg m-4 w-20 h-12" >2</ div >
< div class = "bg-green-500 rounded-lg m-4 w-20 h-12" >3</ div >
< div class = "bg-green-500 rounded-lg m-4 w-20 h-12" >4</ div >
< div class = "bg-green-500 rounded-lg m-4 w-20 h-12" >5</ div >
< div class = "bg-green-500 rounded-lg m-4 w-20 h-12" >6</ div >
</ div >
</ body >
</ html >
|
Output:

justify-items-center: This class is used to justify grid items along their inline axis.
Syntax:
<element class="jjustify-items-center">...</element>
Example:
HTML
<!DOCTYPE html>
< head >
< link href =
rel = "stylesheet" >
</ head >
< body class = "text-center" >
< h1 class = "text-green-600 text-5xl font-bold" >
GeeksforGeeks
</ h1 >
< b >Tailwind CSS Justify Items Class</ b >
< div id = "main" class = "grid justify-items-center grid-cols-2" >
< div class = "bg-green-500 rounded-lg m-4 w-20 h-12" >1</ div >
< div class = "bg-green-500 rounded-lg m-4 w-20 h-12" >2</ div >
< div class = "bg-green-500 rounded-lg m-4 w-20 h-12" >3</ div >
< div class = "bg-green-500 rounded-lg m-4 w-20 h-12" >4</ div >
< div class = "bg-green-500 rounded-lg m-4 w-20 h-12" >5</ div >
< div class = "bg-green-500 rounded-lg m-4 w-20 h-12" >6</ div >
</ div >
</ body >
</ html >
|
Output:

justify-items-stretch: This class is used to stretch items along their inline axis.
Syntax:
<element class="justify-items-stretch">...</element>
Example:
HTML
<!DOCTYPE html>
< head >
< link href =
rel = "stylesheet" >
</ head >
< body class = "text-center" >
< h1 class = "text-green-600 text-5xl font-bold" >
GeeksforGeeks
</ h1 >
< b >Tailwind CSS Justify Items Class</ b >
< div id = "main" class = "grid justify-items-stretch grid-cols-2" >
< div class = "bg-green-500 rounded-lg m-4 h-12" >1</ div >
< div class = "bg-green-500 rounded-lg m-4 h-12" >2</ div >
< div class = "bg-green-500 rounded-lg m-4 h-12" >3</ div >
< div class = "bg-green-500 rounded-lg m-4 h-12" >4</ div >
< div class = "bg-green-500 rounded-lg m-4 h-12" >5</ div >
< div class = "bg-green-500 rounded-lg m-4 h-12" >6</ div >
</ div >
</ body >
</ html >
|
Output:

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!