Tailwind CSS Display

Tailwind CSS Display

Tailwind CSS Display :This class accepts more than one value in tailwind CSS. All the properties are covered as in 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.

Utilities for controlling the display box type of an element.

ClassProperties
blockdisplay: block;
inline-blockdisplay: inline-block;
inlinedisplay: inline;
flexdisplay: flex;
inline-flexdisplay: inline-flex;
tabledisplay: table;
inline-tabledisplay: inline-table;
table-captiondisplay: table-caption;
table-celldisplay: table-cell;
table-columndisplay: table-column;
table-column-groupdisplay: table-column-group;
table-footer-groupdisplay: table-footer-group;
table-header-groupdisplay: table-header-group;
table-row-groupdisplay: table-row-group;
table-rowdisplay: table-row;
flow-rootdisplay: flow-root;
griddisplay: grid;
inline-griddisplay: inline-grid;
contentsdisplay: contents;
list-itemdisplay: list-item;
hiddendisplay: none;

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

Block & Inline

Use inline, inline-block, and block to control the flow of text and elements.

When controlling the flow of text, using the CSS property display: inline will cause the text inside the element to wrap normally.

While using the property display: inline-block will wrap the element to prevent the text inside from extending beyond its parent.

Lastly, using the property display: block will put the element on it’s own line and fill its parent.

.inline-block

inline-block: 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:

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

Example:

Tailwind CSS Display

Hidden

Use hidden to set an element to display: none and remove it from the page layout (compare with .invisible from the visibility documentation).

Tailwind CSS Display

Leave a Comment

Your email address will not be published.