×

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

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 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 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 Stroke

This class accepts a lot of value, and all of the properties are covered in class form. It's the stroke class that goes on top of the SVG element. Stroke...

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

It acknowledges more than one worth in tailwind CSS. Every one of the properties is shrouded as in class structure. It is an option in contrast to the CSS display...

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