×

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 item is justified and aligned simultaneously. You can set several class values in a single class with this class.

Place Self Classes

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

place-self-auto

If the items don't have a parent, place-self-auto is utilized. The absolute location of the objects is defined by this class.

Syntax:

<element class="place-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">
        Tutorial and Example
    </h1>
    <b>Place Self Class - Tailwind CSS </b>
    <div id="main" class="ml-24 h-48 w-2/3 grid grid-cols-3 gap-2
                          place-items-stretch
                          h-48 bg-red-200 border-solid border-4
                          border-red-900">
        <div class="bg-red-900 w-3/4">1</div>
        <div class="bg-red-800 place-self-auto w-3/4">2</div>
        <div class="bg-red-700 w-3/4">3</div>
        <div class="bg-red-600 w-3/4">4</div>
        <div class="bg-red-500 w-3/4">5</div>
        <div class="bg-red-400 w-3/4">6</div>
    </div>
</body>
</html>

Output:

Tailwind CSS Place Self

place-self-start

The lines at the start of the flex container are displayed using this class.

Syntax:

<element class="place-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">
       Tutorial and Example
    </h1>
    <b>Place Self Class - Tailwind CSS </b>
    <div id="main" class="ml-24 h-48 w-2/3 grid grid-cols-3 gap-2
                          place-items-stretch
                          h-48 bg-red-200 border-solid border-4
                          border-red-900">
        <div class="bg-red-900 w-3/4">1</div>
        <div class="bg-red-800 place-self-start w-3/4">2</div>
        <div class="bg-red-700 w-3/4">3</div>
        <div class="bg-red-600 w-3/4">4</div>
        <div class="bg-red-500 w-3/4">5</div>
        <div class="bg-red-400 w-3/4">6</div>
    </div>
</body>
</html>

Output:

Tailwind CSS Place Self

place-self-end

The flex lines at the end of the flex container are displayed using this class.

Syntax:

<element class="place-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">
       Tutorial and Example
    </h1>
    <b>Place Self Class - Tailwind CSS </b>
    <div id="main" class="ml-24 h-48 w-2/3 grid grid-cols-3 gap-2
                          place-items-stretch
                          h-48 bg-red-200 border-solid border-4
                          border-red-900">
        <div class="bg-red-900 w-3/4">1</div>
        <div class="bg-red-800 place-self-end w-3/4">2</div>
        <div class="bg-red-700 w-3/4">3</div>
        <div class="bg-red-600 w-3/4">4</div>
        <div class="bg-red-500 w-3/4">5</div>
        <div class="bg-red-400 w-3/4">6</div>
    </div>
</body>
</html>

Output:

Tailwind CSS Place Self

place-self-center

The place-self-center class is used to align flex elements to the container's center.

Syntax:

<element class="place-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">
       Tutorial and Example
    </h1>
    <b>Place Self Class - Tailwind CSS </b>
    <div id="main" class="ml-24 h-48 w-2/3 grid grid-cols-3 gap-2
                          place-items-stretch
                          h-48 bg-red-200 border-solid border-4
                          border-red-900">
        <div class="bg-red-900 w-3/4">1</div>
        <div class="bg-red-800 place-self-center w-3/4">2</div>
        <div class="bg-red-700 w-3/4">3</div>
        <div class="bg-red-600 w-3/4">4</div>
        <div class="bg-red-500 w-3/4">5</div>
        <div class="bg-red-400 w-3/4">6</div>
    </div>
</body>
</html>

Output:

Tailwind CSS Place Self

place-self-stretch

This class defines a line that is stretched to fill the flex container's remaining space. It's the default setting.

Syntax:

<element class="place-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">
       Tutorial and Example
    </h1>
    <b>Place Self Class - Tailwind CSS </b>
    <div id="main" class="ml-24 h-48 w-2/3 grid grid-cols-3 gap-2
                          place-items-stretch
                          h-48 bg-red-200 border-solid border-4
                          border-red-900">
        <div class="bg-red-900 w-3/4">1</div>
        <div class="bg-red-800 place-self-stretch w-3/4">2</div>
        <div class="bg-red-700 w-3/4">3</div>
        <div class="bg-red-600 w-3/4">4</div>
        <div class="bg-red-500 w-3/4">5</div>
        <div class="bg-red-400 w-3/4">6</div>
    </div>
</body>
</html>

Output:

Tailwind CSS Place Self

Related Topics

Tailwind CSS Max-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 Max-Height attribute. It is used to...

3 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 Gap

In tailwind CSS, this class accepts multiple values, and all of the properties are covered in class form. It's a replacement for the CSS gap attribute. This class is used...

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 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 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 Grid Template Rows

In tailwind CSS, this class accepts multiple values and all properties are covered in class form. It's the CSS grid-template-row property's replacement. It is used to set the number of...

2 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 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 Flex Direction

CSS flexbox is an important element for frontend development. CSS has four directions, therefore in tailwind CSS, all of the properties are covered in class form. It's a front-end development...

5 minutes read.

Tailwind CSS Align Items

In tailwind CSS, this class accepts a wide range of values. It's a replacement for the CSS Align Items attribute. This class is used to align things within the flexible...

5 minutes read.

Tailwind CSS Visibility

In tailwind CSS, this class accepts two values. It's a replacement for the CSS visibility property. This class specifies whether an element in a web document is visible or not,...

2 minutes read.

Tailwind CSS Grid Template Columns

In tailwind CSS, this class accepts multiple values, and all of the properties are covered in class form. It's the CSS grid-template-columns property's replacement. It's used to specify the number...

2 minutes read.

Tailwind CSS Width

The tailwind CSS width class accepts a large number of values, and all of the properties are covered in class form. It's a replacement for the CSS Width Property. This...

3 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 Opacity

This class accepts a lot of value, and all of the properties are covered in class form. We can change the opacity of any element by using this class. The...

1 minute 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 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 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 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.