×

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 to set the spacing between the rows and columns, commonly known as the gutter. As with column-gap and row-gap, they are used separately so that the gap property can be used to specify both a column and a row gap.

Gap

There are 105 classes in all for gap, with the x and y axes listed separately.

  • gap-0
  • gap-x-0
  • gap-y-0
  • gap-0.5
  • gap-x-0.5
  • gap-y-0.5
  • gap-1
  • gap-x-1
  • gap-y-1
  • gap-1.5
  • gap-x-1.5
  • gap-y-1.5
  • gap-2
  • gap-x-2
  • gap-y-2
  • gap-2.5
  • gap-x-2.5
  • gap-y-2.5
  • gap-3
  • gap-x-3 
  • gap-y-3 
  • gap-3.5 
  • gap-x-3.5
  • gap-y-3.5
  • gap-4 
  • gap-x-4
  • gap-y-4
  • gap-5
  • gap-x-5
  • gap-y-5
  • gap-6 
  • gap-x-6
  • gap-y-6
  • gap-7
  • gap-x-7
  • gap-y-7
  • gap-8 
  • gap-x-8
  • gap-y-8 
  • gap-9 
  • gap-x-9
  • gap-y-9 
  • gap-10 
  • gap-x-10 
  • gap-y-10 
  • gap-11
  • gap-x-11 
  • gap-y-11 
  • gap-12 
  • gap-x-12 
  • gap-y-12 
  • gap-14 
  • gap-x-14 
  • gap-y-14 
  • gap-16 
  • gap-x-16 
  • gap-y-16 
  • gap-20 
  • gap-x-20 
  • gap-y-20 
  • gap-24 
  • gap-x-24 
  • gap-y-24 
  • gap-28 
  • gap-x-28 
  • gap-y-28 
  • gap-32 
  • gap-x-32 
  • gap-y-32 
  • gap-36 
  • gap-x-36 
  • gap-y-36 
  • gap-40 
  • gap-x-40 
  • gap-y-40 
  • gap-44 
  • gap-x-44
  • gap-y-44
  • gap-48 
  • gap-x-48 
  • gap-y-48 
  • gap-52 
  • gap-x-52
  • gap-y-52
  • gap-56 
  • gap-x-56
  • gap-y-56
  • gap-60 
  • gap-x-60
  • gap-y-60
  • gap-64 
  • gap-x-64
  • gap-y-64
  • gap-72 
  • gap-x-72
  • gap-y-72
  • gap-80 
  • gap-x-80
  • gap-y-80
  • gap-96 
  • gap-x-96
  • gap-y-96
  • gap-px 
  • gap-x-px
  • gap-y-px

gap-number: Using simply the gap class and not mentioning the axis will retain the in both axes according to the number mentioned:

Syntax

<element class="gap-number"> Contents... </element>

Parameter: As noted above and as described below, this class accepts only one value:

number: The element's gap size is stored here.

Example:

<!DOCTYPE html>
<html>
<head>
    <title>Tailwind gap Class</title>
    <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>Tailwind CSS gap Class</b>
    <div id="main" class="grid grid-rows-2
                          grid-flow-col gap-5">
        <div class="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 class="bg-red-500 rounded-lg m-4 h-12">5</div>
        <div class="bg-red-500 rounded-lg m-4 h-12">6</div>
    </div>
</body>
</html>

Output:

Tailwind CSS Gap

gap-x-number: The gap-x class maintains the x-axis gap according to the specified number:

Syntax

<element class="gap-x-number"> Contents... </element>

Example:

<!DOCTYPE html>
<html>
<head>
    <title>Tailwind gap-x-number Class</title>
    <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>gap-x-number Class - Tailwind CSS </b>
    <div id="main" class="grid grid-rows-2
                          grid-flow-col gap-x-5">
        <div class="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 class="bg-red-500 rounded-lg m-4 h-12">5</div>
        <div class="bg-red-500 rounded-lg m-4 h-12">6</div>
    </div>
</body>
</html>

Output:

Tailwind CSS Gap

gap-y-number: The gap-y class maintains the x-axis gap according to the specified number:

Syntax

<element class="gap-y-number"> Contents... </element>

Example:

<!DOCTYPE html>
<html>
<head>
    <title>Tailwind gap-y-number Class</title>
    <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>gap-y-number Class - Tailwind CSS </b>
    <div id="main" class="grid grid-rows-2
                          grid-flow-col gap-y-5">
        <div class="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 class="bg-red-500 rounded-lg m-4 h-12">5</div>
        <div class="bg-red-500 rounded-lg m-4 h-12">6</div>
    </div>
</body>
</html>

Output:

Tailwind CSS Gap

Related Topics

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