×

Tailwind CSS Justify Self

The class form goes over the various properties. It's a replacement for the CSS justify-self attribute. This class is used to describe the alignment of content’s position in a CSS Grid, as well as the relevant axis.

Justify self class options

The options are classified as:

  • justify-self-auto 
  • justify-self-start 
  • justify-self-end 
  • justify-self-center 
  • justify-self-stretch

justify-self-auto

It is the value that's utilized to align an item based on the grid's justify-items class value.

Syntax:

<element class="justify-self-auto">...</element>

Example:

<!DOCTYPE html> 
<head> 
    <link href=
"https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" 
          rel="stylesheet"> 
</head> 
  
<body class="text-center"> 
    <h1 class="text-red-600 text-5xl font-bold">
        Javatpoint
    </h1> 
    <b>Justify Self Class - Tailwind CSS </b> 
    <div id="main" class="grid justify-items-stretch grid-cols-2"> 
        <div class="justify-self-auto bg-red-500 rounded-lg m-4 h-12">
          1
        </div> 
        <div class="bg-red-500 rounded-lg m-4 h-12">2</div> 
        <div class="bg-red-500 rounded-lg m-4 h-12">3</div> 
        <div class="bg-red-500 rounded-lg m-4 h-12">4</div>
    </div> 
</body> 
  
</html>

Output:

Tailwind CSS Justify Self

justify-self-start

It allows the content to align to the cell's left side.

Syntax:

<element class="justify-self-start">...</element>

Example:

<!DOCTYPE html> 
<head> 
    <link href=
"https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" 
          rel="stylesheet"> 
</head> 
  
<body class="text-center"> 
    <h1 class="text-red-600 text-5xl font-bold">
        Javatpoint
    </h1> 
    <b>Justify Self Class - Tailwind CSS </b> 
    <div id="main" class="grid justify-items-stretch grid-cols-2"> 
        <div class="justify-self-start bg-red-500 rounded-lg m-4 h-12">
          1
        </div> 
        <div class="bg-red-500 rounded-lg m-4 h-12">2</div> 
        <div class="bg-red-500 rounded-lg m-4 h-12">3</div> 
        <div class="bg-red-500 rounded-lg m-4 h-12">4</div>
    </div> 
</body> 
  
</html>

Output:

Tailwind CSS Justify Self

justify-self-end

It enables the content to align itself to the cell's right.

Syntax:

<element class="justify-self-end">...</element>

Example:

<!DOCTYPE html> 
<head> 
    <link href=
"https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" 
          rel="stylesheet"> 
</head> 
  
<body class="text-center"> 
    <h1 class="text-red-600 text-5xl font-bold">
        Javatpoint
    </h1> 
    <b>Justify Self Class - Tailwind CSS </b> 
    <div id="main" class="grid justify-items-stretch grid-cols-2"> 
        <div class="justify-self-end bg-red-500 rounded-lg m-4 h-12">
          1
        </div> 
        <div class="bg-red-500 rounded-lg m-4 h-12">2</div> 
        <div class="bg-red-500 rounded-lg m-4 h-12">3</div> 
        <div class="bg-red-500 rounded-lg m-4 h-12">4</div>
    </div> 
</body> 
  
</html>

Output:

Tailwind CSS Justify Self

justify-self-center

 It enables the content to align itself with the cell's center.

Syntax:

<element class="justify-self-center">...</element>

Example:

<!DOCTYPE html> 
<head> 
    <link href=
"https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" 
          rel="stylesheet"> 
</head> 
  
<body class="text-center"> 
    <h1 class="text-red-600 text-5xl font-bold">
        Javatpoint
    </h1> 
    <b>Justify Self Class - Tailwind CSS </b> 
    <div id="main" class="grid justify-items-stretch grid-cols-2"> 
        <div class="justify-self-center bg-red-500 rounded-lg m-4 h-12">
          1
        </div> 
        <div class="bg-red-500 rounded-lg m-4 h-12">2</div> 
        <div class="bg-red-500 rounded-lg m-4 h-12">3</div> 
        <div class="bg-red-500 rounded-lg m-4 h-12">4</div>
    </div> 
</body> 
  
</html>

Output:

Tailwind CSS Justify Self

justify-self-stretch

This property's default value causes the content to cover the entire width of the cell.

Syntax:

<element class="justify-self-stretch">...</element>

Example:

<!DOCTYPE html> 
<head> 
    <link href=
"https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" 
          rel="stylesheet"> 
</head> 
  
<body class="text-center"> 
    <h1 class="text-red-600 text-5xl font-bold">
        Javatpoint
    </h1> 
    <b>Justify Self Class - Tailwind CSS </b> 
    <div id="main" class="grid justify-items-stretch grid-cols-2"> 
        <div class="justify-self-stretch bg-red-500 rounded-lg m-4 h-12">
          1
        </div> 
        <div class="bg-red-500 rounded-lg m-4 h-12">2</div> 
        <div class="bg-red-500 rounded-lg m-4 h-12">3</div> 
        <div class="bg-red-500 rounded-lg m-4 h-12">4</div>
    </div> 
</body> 
  
</html>

Output:

Tailwind CSS Justify Self

Related Topics

Tailwind CSS Stroke Width

In tailwind CSS, this class takes a large number of values and all of the properties are covered in the form. It is used to specify the width of an...

1 minute read.

Tailwind CSS Justify Items

It is a replacement for the CSS justify-items attribute. This class is used to regulate the alignment of grid objects along their inline axis. Justify Item It is classified as: justify-items-auto justify-items-start justify-items-end justify-items-center justify-items-stretch justify-items-auto The justify-items-auto class...

4 minutes read.

Tailwind CSS Top / Right / Bottom / Left

In tailwind CSS, these classes take a variety of values and cover all of the characteristics in the class form. These are the CSS Top/Right/Bottom/Left properties' replacements. These classes are...

4 minutes read.

Tailwind CSS Flex Shrink

CSS flexbox is an important element for frontend development. There are two flex-shrink options in Tailwind CSS, and all properties are covered in class form. For quick front-end development, it's...

3 minutes read.

Tailwind CSS tutorial

Tailwind CSS can be utilized to make sites in the quickest and the least demanding way. Tailwind CSS is the most famous utility-first CSS structure on the planet for quickly...

4 minutes read.

Tailwind CSS Flex Grow

CSS flexbox is an important element for frontend development; there are two flex-grow options in Tailwind CSS, and all attributes are covered in class form. It is an alternative to...

3 minutes read.

Tailwind CSS Place Content

This class accepts a wide range of values. It's a replacement for the CSS Place Content property. This class is used to manage how information is justified while still being...

5 minutes read.

Tailwind CSS Flex

CSS flexbox is an important component for frontend development. There are four flex options in Tailwind CSS, and all of the attributes are covered in class form. It's a front-end...

6 minutes read.

Tailwind CSS Float

The float class acknowledges more than one worth (value) in tailwind CSS. It is an option in contrast to the CSS float property. The float class characterizes the progression of...

4 minutes read.

Tailwind CSS Grid Auto Flow

In tailwind CSS, this class accepts multiple values, and all of the properties are covered in class form. It is a CSS alternative. The grid-auto-flow property is used in Tailwind...

4 minutes read.

Tailwind CSS Padding

This class accepts a large number of values, and all of the properties are covered in class form. It's a replacement for the CSS Padding Property. This class is used...

4 minutes read.

Tailwind CSS Align Self

This class accepts a wide range of values. It's a replacement for the CSS Align Self attribute. This class is used to control how a flex or grid item is...

4 minutes read.

Tailwind CSS Flex Wrap

CSS flexbox is an important component for frontend development. It is a front-end development alternative to the CSS flex-wrap Property. Note: You must include the flex class in your element before...

4 minutes read.

Tailwind CSS Align Content

In Tailwind CSS, this class accepts a wide range of values. It's a replacement for the CSS Align Content feature. This class is used to modify the flex-wrap property's behavior....

5 minutes read.

Tailwind CSS Position

The position class acknowledges more than one value in tailwind CSS. It is an option in contrast to the CSS Position property. This class is utilized for controlling how an...

5 minutes read.

Tailwind CSS Box Shadow

The Tailwind CSS Box Shadow class accepts a lot of value, and all of the properties are covered in class form. We may control the box-shadow of an element by...

2 minutes read.

Tailwind CSS Grid Auto Rows

In tailwind CSS, this class takes multiple values and covers all of the properties in class form. It's a replacement for the grid-auto-rows CSS attribute. The size of the rows...

6 minutes read.

Tailwind CSS Container

In Tailwind CSS, a compartment is utilized to fix the maximum width (max-width) of a component to match the min-width of the breakpoint. It comes exceptionally convenient when content must...

2 minutes read.

Tailwind CSS Justify Self

The class form goes over the various properties. It's a replacement for the CSS justify-self attribute. This class is used to describe the alignment of content’s position in a CSS...

4 minutes read.

Tailwind CSS Space Between

In tailwind CSS, this class accepts a large number of values, and all of the properties are covered in class form. It's a replacement for the CSS Space Between property....

4 minutes read.