×

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

CSS flexbox is an important element for frontend development. There are two flex-shrink options in Tailwind CSS, and all properties are covered in class form. For quick front-end development, it's...

3 minutes read.

Tailwind CSS Justify Content

In tailwind CSS, this class accepts two values. It's a replacement for CSS's justify-content attribute. This class is used to describe the flexible box container's alignment. Along the main axis...

4 minutes read.

Tailwind CSS Installation

Here, we will discuss the installation method of Tailwind CSS using two strategies discussed as follows: Strategy 1: Install Tailwind through npm Step 1: npm init - y Step 2: npm install tailwindcss Step...

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

CSS flexbox is an important component for frontend development. It is a front-end development alternative to the CSS flex-wrap Property. Note: You must include the flex class in your element before...

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