×

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 property. This class is utilized to characterize how the parts (div, hyperlink, heading, and so on) will be put on the site page. As the name proposes, this property is utilized to characterize the display of the various pieces of a website page.

Display Classes

The display classes are listed as follows:

  • block: It is utilized to show a component as a block component (element).
  • inline-block: It is utilized to show an element as an inline-level block holder(container).
  • inline: It is utilized to show an element as an inline element.
  • flex: It is utilized to show an element as a block-level flex holder.
  • inline-flex: It is utilized to show an element as an inline-level flex holder.
  • table: It is utilized to set the conduct as <table> for all components.
  • table-caption: It is utilized to set the conduct as <caption> for all components.
  • table-cell: It is utilized to set the conduct as <td> for all components.
  • table-column: It is utilized to set the conduct as <col> for all components.
  • table-column-group: It is utilized to set the conduct as <column> for all components.
  • table-footer-group: It is utilized to set the conduct as <footer> for all components.
  • table-header-group: It is utilized to set the conduct as <header> for all components.
  • table-row-group: It is utilized to set the conduct as <row> for all components.
  • table-row: It is utilized to set the conduct as <tr> for all components.
  • flow-root: It is utilized to set the default value.
  • grid: It is utilized to show an element as a block-level grid container.
  • inline-grid: It is utilized to show a component as an inline-level grid container.
  • contents: It is utilized to vanish the container.
  • hidden: It is utilized to eliminate the element.
  • block: It is utilized to show an element as a block-level element. It is a default property of div. This class puts the div consistently in an upward direction. The height and width of the div can be changed utilizing the block class on the off chance that the width isn't referenced, then, at that point, the div under block class will take up the width of the container.

Syntax:

<element display="block">...</element>

Code Examples

Example 1:

Code is as follows:

<!DOCTYPE html> 
<head> 
<link href=
"https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" 
rel="stylesheet"> 
</head> 
<body class="text-center"> 
<center>
<h1 class="text-red-600 text-5xl font-bold">
Tutorial and Example
</h1> 
<b> block Class - Tailwind CSS</b> 
<div class="bg-red-200 p-4 mx-16 space-y-4">
<span class="block h-12 bg-red-500 rounded-lg">1</span>
<span class="block h-12 bg-red-500 rounded-lg">2</span>
<span class="block h-12 bg-red-500 rounded-lg">3</span>
</div> 
</center>
</body> 
</html>

The output for the above code is:

Tailwind CSS Display

inline-block: It is utilized to show an element as an inline-level block container. This component utilizes the two properties referenced above, block and inline. Thus, this class adjusts the div inline yet the thing that matters is it can alter (edit) the height and the width of the block. Essentially, this will adjust the div both in the block and inline design (fashion).

Syntax:

<element display="inline-block">...</element>

Example 2:

Code is as follows:

<!DOCTYPE html> 
<head> 
<link href=
"https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" 
rel="stylesheet"> 
</head> 
<body class="text-center"> 
<center>
<h1 class="text-red-600 text-5xl font-bold">
Tutorial and Example
</h1> 
<b>inline-block Class - Tailwind CSS </b> 
<div class="bg-red-200 p-4 mx-16 space-y-4">
<span class="inline-block w-32 h-12 bg-red-500 rounded-lg">1</span>
<span class="inline-block w-32 h-12 bg-red-500 rounded-lg">2</span>
<span class="inline-block w-32 h-12 bg-red-500 rounded-lg">3</span>
</div> 
</center>
</body> 
</html>

The output for the above code is:

Tailwind CSS Display

inline: It is utilized to show an element as an inline element. This class is the default property of anchor labels (tags). It is utilized to put the div inline in a level way (horizontal manner). The inline display property disregards the height and the width set by the client (user).

Syntax:

<element display="inline">...</element>

Example 3:

Code is as follows:

<!DOCTYPE html> 
<head> 
<link href=
"https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" 
rel="stylesheet"> 
</head> 
<body class="text-center"> 
<center>
<h1 class="text-red-600 text-5xl font-bold">
Tutorial and Example
</h1> 
<b>inline Class - Tailwind CSS </b> 
<div class="bg-red-200 p-4 mx-16 space-y-4">
<span class="inline bg-red-500 rounded-lg">1</span>
<span class="inline bg-red-500 rounded-lg">2</span>
<span class="inline bg-red-500 rounded-lg">3</span>
</div> 
</center>
</body> 
</html>

The output for the above code is:

Tailwind CSS Display

flex: The flex class is a lot responsive and versatile or we can say mobile-friendly. It is not difficult to situate child elements and the main container. The margin doesn't implode with the content margins. The order for any element can be effortlessly different without altering the HTML area (section).

Syntax:

<element display="flex">...</element>

Example 4:

Code is as follows:

<!DOCTYPE html> 
<head> 
<link href=
"https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" 
rel="stylesheet"> 
</head> 
<body class="text-center"> 
<center>
<h1 class="text-red-600 text-5xl font-bold">
Tutorial and Example
</h1> 
<b>flex Class - Tailwind CSS </b> 
<div class="flex bg-red-200 p-4 mx-16 ">
<div class="flex-1 bg-red-500 rounded-lg">1</div>
<div class="flex-1 bg-red-500 rounded-lg">2</div>
<div class="flex-1 bg-red-500 rounded-lg">3</div>
</div> 
</center>
</body> 
</html>

The output for the above code is:

Tailwind CSS Display


Related Topics

Tailwind CSS Top / Right / Bottom / Left

In tailwind CSS, these classes take a variety of values and cover all of the characteristics in the class form. These are the CSS Top/Right/Bottom/Left properties' replacements. These classes are...

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

The margin class accepts a large number of values, and all of the properties are covered in the same way they are in the class form. It's a replacement for...

6 minutes read.

Tailwind CSS Order

One of the best features of Tailwind CSS is the Order class, which allows us to order flex and grid objects according to our needs. There are several different order...

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

CSS flexbox is an important component for frontend development. There are four flex options in Tailwind CSS, and all of the attributes are covered in class form. It's a front-end...

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