×

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 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 Min-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 min-width property. This...

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

The tailwind CSS width class accepts a large number of values, and all of the properties are covered in class form. It's a replacement for the CSS Width Property. This...

3 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 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 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 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 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 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 Content

This class accepts a wide range of values. It's a replacement for the CSS Place Content property. This class is used to manage how information is justified while still being...

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

The position class acknowledges more than one value in tailwind CSS. It is an option in contrast to the CSS Position property. This class is utilized for controlling how an...

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