×

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 Height

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 height property. This class is used...

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 Grid Column Start / End

This class accepts multiple values, and all of the properties are covered in class form. It was used as a replacement to the CSS grid-column property in CSS to express...

3 minutes read.

Tailwind CSS Max-Width

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 max-width property. This...

3 minutes read.

Tailwind CSS Object Position

It acknowledges more than one value in tailwind CSS. Every one of the properties is covered as in class form. It is the option in contrast to the CSS object-position...

2 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 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 Clear

This class acknowledges more than one worth in tailwind CSS. Every one of the properties is canvassed as in class form. It is an option in contrast to the CSS...

5 minutes read.

Tailwind CSS Order

One of the best features of Tailwind CSS is the Order class, which allows us to order flex and grid objects according to our needs. There are several different order...

2 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 Min-Width

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 min-width property. This...

1 minute read.

Tailwind CSS Grid Auto Columns

The Grid Auto Columns class accepts multiple values, and all of the properties are covered in class form. It's a replacement for the CSS grid-auto-columns property. The size of the...

5 minutes read.

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 Min-Height

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 Min-Height Property. It...

2 minutes read.

Tailwind CSS Installation

Here, we will discuss the installation method of Tailwind CSS using two strategies discussed as follows: Strategy 1: Install Tailwind through npm Step 1: npm init - y Step 2: npm install tailwindcss Step...

2 minutes read.

Tailwind CSS Place Self

The tailwind CSS Place self class accepts a wide range of values. It's a replacement for the CSS Place Items property. This class is used to manage how a single...

4 minutes read.

Tailwind CSS Justify Content

In tailwind CSS, this class accepts two values. It's a replacement for CSS's justify-content attribute. This class is used to describe the flexible box container's alignment. Along the main axis...

4 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 Place Items

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

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.