Tailwind CSS Display (original) (raw)

Last Updated : 23 Jul, 2025

This class accepts more than one value in Tailwind CSS. All the properties are covered in a class form. It is the alternative to the CSS display property. This class is used to define how the components (div, hyperlink, heading, etc) are going to be placed on the web page. As the name suggests, this property is used to define the display of the different parts of a web page.

**Display Classes

for all elements. for all elements.
Class Name Description
**block Display an element as a block element.
**inline-block Display an element as an inline-level block container.
**inline Display an element as an inline element.
**flex Display an element as a block-level flex container.
**inline-flex Display an element as an inline-level flex container.
**table Set the behavior as for all elements.
**table-caption Set the behavior as
for all elements.
**table-cell Set the behavior as for all elements.
**table-column Set the behavior as
**table-column-group Set the behavior as for all elements.
**table-footer-group Set the behavior as
for all elements.
**table-header-group Set the behavior as
for all elements.
**table-row-group Set the behavior as for all elements.
**table-row Set the behavior as
**flow-root Set the default value.
**grid Display an element as a block-level grid container.
**inline-grid Display an element as an inline-level grid container.
**contents Disappear the container.
**hidden Remove the element.

**Tailwind CSS Block Element (block Class)

It is used to display an element as a block-level element. This class is used as the default property of _div. This class places the div one after another vertically. The height and width of the _div can be changed using the block class if the width is not mentioned, then the _div under block class will take up the width of the container.

**Syntax:

...

**Example 1:

HTML `

GeeksforGeeks

<b>Tailwind CSS block Class</b>

<div class="bg-green-200 p-4 mx-16 space-y-4">
    <span class="block h-12 bg-green-500 rounded-lg">1</span>
    <span class="block h-12 bg-green-500 rounded-lg">2</span>
    <span class="block h-12 bg-green-500 rounded-lg">3</span>
</div>

`

**Output:

**Tailwind CSS Inline Block Element (inline-block Class)

It is used to display an element as an inline-level block container. This feature uses both properties mentioned above, block and inline. So, this class aligns the _div inline but the difference is it can edit the height and the width of the block. Basically, this will align the div both in the block and inline fashion.

**Syntax:

...

**Example 2:

HTML `

GeeksforGeeks

<b>Tailwind CSS inline-block Class</b>

<div class="bg-green-200 p-4 mx-16 space-y-4">
    <span class="inline-block w-32 h-12 bg-green-500 rounded-lg">1</span>
    <span class="inline-block w-32 h-12 bg-green-500 rounded-lg">2</span>
    <span class="inline-block w-32 h-12 bg-green-500 rounded-lg">3</span>
</div>

`

**Output:

**Tailwind CSS Inline Block Element (inline Class)

It is used to display an element as an inline element. This class is the default property of anchor tags. This is used to place the div inline i.e. in a horizontal manner. The inline display property ignores the height and the width set by the user.

**Syntax:

...

**Example 3:

HTML `

GeeksforGeeks

Tailwind CSS inline Class
1 2 3

`

**Output:

**Tailwind CSS Flex Element (flex Class)

The _flex class is much responsive and mobile-friendly. It is easy to position child elements and the main container. The margin doesn’t collapse with the content margins. The order of any element can be easily changed without editing the HTML section.

**Syntax:

...

**Example 4:

HTML `

GeeksforGeeks

<b>Tailwind CSS flex Class</b>

<div class="flex bg-green-200 p-4 mx-16 ">
    <div class="flex-1 bg-green-500 rounded-lg">1</div>
    <div class="flex-1 bg-green-500 rounded-lg">2</div>
    <div class="flex-1 bg-green-500 rounded-lg">3</div>
</div>

`

**Output: