×

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. The space between child items is controlled by this class.

Space Between classes

  • space-y-0
  • space-y-reverse
  • -space-y-0
  • space-x-0
  • space-x-reverse
  • -space-x-0

Note: You can replace "0" with any of the allowed "rem" values.

space-y-0

This class is used to conduct space operations on the y-axis.

Syntax:

<element class="space-y-0">...</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>Space Between Class - Tailwind CSS </b>
    <div class="mx-4 space-y-4">
        <div class="bg-red-400 h-16 rounded-lg
                    border-2 border-green-800">1</div>
        <div class="bg-red-400 h-16 rounded-lg
                    border-2 border-green-800">2</div>
        <div class="bg-red-400 h-16 rounded-lg
                    border-2 border-green-800">3</div>
        <div class="bg-red-400 h-16 rounded-lg
                    border-2 border-green-800">4</div>
    </div>
</body>
</html>

Output:

Tailwind CSS Space Between

space-y-reverse

This class is used to execute reverse spacing on the y-axis, but it must be used before the flex-reverse class.

Syntax:

<element class="space-y-reverse">...</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>Space Between Class - Tailwind CSS </b>
    <div class="mx-4 flex flex-col-reverse space-y-4
                space-y-reverse">
        <div class="bg-red-400 h-16 rounded-lg">1</div>
        <div class="bg-red-400 h-16 rounded-lg">2</div>
        <div class="bg-red-400 h-16 rounded-lg">3</div>
        <div class="bg-red-400 h-16 rounded-lg">4</div>
    </div>
</body>
</html>

Output:

Tailwind CSS Space Between

space-y-0

This class is used to create negative x-axis spacing. We can nest one element inside another by using this class.

Syntax:

<element class="-space-y-0">...</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>Space Between Class - Tailwind CSS </b>
    <div class="mx-4 -space-y-4">
        <div class="bg-red-400 h-16 rounded-lg
                    border-2 border-red-800">1</div>
        <div class="bg-red-400 h-16 rounded-lg
                    border-2 border-red-800">2</div>
        <div class="bg-red-400 h-16 rounded-lg
                    border-2 border-red-800">3</div>
        <div class="bg-red-400 h-16 rounded-lg
                    border-2 border-red-800">4</div>
    </div>
</body>
</html>

Output:

Tailwind CSS Space Between

space-x-0

This class is used to conduct space operations on the x-axis.

Syntax:

<element class="space-x-0">...</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>Space Between Class - Tailwind CSS </b>
    <div class="ml-48 flex space-x-4">
        <div class="bg-red-400 w-20 h-16 rounded-lg">1</div>
        <div class="bg-red-400 w-20 h-16 rounded-lg">2</div>
        <div class="bg-red-400 w-20 h-16 rounded-lg">3</div>
        <div class="bg-red-400 w-20 h-16 rounded-lg">4</div>
    </div>
</body>
</html>

Output:

Tailwind CSS Space Between

space-x-reverse

This class is used to execute reverse spacing on the x-axis, but it must be used before the flex-reverse class.

Syntax:

<element class="space-x-reverse">...</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>Space Between Class - Tailwind CSS </b>
    <div class="ml-48 flex flex-row-reverse space-x-4
                space-x-reverse">
        <div class="bg-red-400 w-20 h-16 rounded-lg">1</div>
        <div class="bg-red-400 w-20 h-16 rounded-lg">2</div>
        <div class="bg-red-400 w-20 h-16 rounded-lg">3</div>
        <div class="bg-red-400 w-20 h-16 rounded-lg">4</div>
    </div>
</body>
</html>

Output:

Tailwind CSS Space Between

space-x-0

This class is used for negative x-axis spacing. We can use this class to nest one element inside another.

Syntax:

<element class="-space-x-0">...</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>Space Between Class - Tailwind CSS </b>
    <div class="ml-48 flex -space-x-4">
        <div class="bg-red-400 w-20 h-16 rounded-lg
                    border-2 border-red-800">1</div>
        <div class="bg-red-400 w-20 h-16 rounded-lg
                    border-2 border-red-800">2</div>
        <div class="bg-red-400 w-20 h-16 rounded-lg
                    border-2 border-red-800">3</div>
        <div class="bg-red-400 w-20 h-16 rounded-lg
                    border-2 border-red-800">4</div>
    </div>
</body>
</html>

Output:

Tailwind CSS Space Between

Related Topics

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 Row Start / End

In tailwind CSS, this class takes several values. All of the attributes are covered in the form of a class. In CSS, it's an alternative to the grid-row attribute. It's...

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 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 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 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 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 Z-index

The tailwind CSS framework is a CSS utility framework that provides classes for managing HTML content with CSS. Tailwind CSS simplifies our design process and makes it responsive across numerous...

4 minutes read.

Tailwind CSS Object Fit

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

4 minutes 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 Fill

The CSS Fill class accepts a lot of value, and all of the properties are covered in class form. It is a presentation attribute that controls how an SVG shape's...

1 minute read.

Tailwind CSS Box Sizing

Tailwind CSS Box sizing class acknowledges more than one worth in tailwind CSS. Each property is shrouded as a class structure. It is an option in contrast to the CSS...

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

The overflow class acknowledges more than one value in Tailwind CSS. It is an option in contrast to the CSS Overflow property. This overflow is for controlling how element content...

9 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 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 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 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.