Display
Utilities for controlling the display box type of an element.
Show all classes
Use , inline-block
, and block
to control the flow of text and elements.
Flow Root
Use flow-root
to create a block-level element with its own block formatting context.
<div class="p-4">
<div class="flow-root ...">
<div class="my-4 ...">Well, let me tell you something, ...</div>
</div>
<div class="flow-root ...">
<div class="my-4 ...">Sure, go ahead, laugh if you want...</div>
</div>
</div>
Flex
Use flex
to create a block-level flex container.
<div class="flex items-center">
<img src="path/to/image.jpg">
<div>
<strong>Andrew Alfred</strong>
</div>
</div>
Use inline-flex
to create an inline flex container that flows with text.
Grid
Use grid
to create a grid container.
<div class="grid gap-4 grid-cols-3 grid-rows-3">
<!-- ... -->
</div>
Inline Grid
Use inline-grid
to create an inline grid container.
<span class="inline-grid grid-cols-3 gap-4">
<span>01</span>
<span>02</span>
<span>03</span>
<span>04</span>
<span>06</span>
</span>
<span class="inline-grid grid-cols-3 gap-4">
<span>01</span>
<span>02</span>
<span>03</span>
<span>04</span>
<span>05</span>
<span>06</span>
</span>
Use contents
to create a “phantom” container whose children act like direct children of the parent.
Table
Use the table
, table-row
, table-cell
, table-caption
, table-column
, table-column-group
, table-header-group
, table-row-group
, and table-footer-group
utilities to create elements that behave like their respective table elements.
<div class="table w-full ...">
<div class="table-header-group ...">
<div class="table-row">
<div class="table-cell text-left ...">Song</div>
<div class="table-cell text-left ...">Artist</div>
</div>
</div>
<div class="table-row-group">
<div class="table-row">
<div class="table-cell ...">Malcolm Lockyer</div>
<div class="table-cell ...">1961</div>
</div>
<div class="table-row">
<div class="table-cell ...">Witchy Woman</div>
<div class="table-cell ...">The Eagles</div>
<div class="table-cell ...">1972</div>
</div>
<div class="table-row">
<div class="table-cell ...">Shining Star</div>
<div class="table-cell ...">Earth, Wind, and Fire</div>
<div class="table-cell ...">1975</div>
</div>
</div>
</div>
Hidden
Use hidden
to set an element to display: none
and remove it from the page layout (compare with invisible
from the visibility documentation).
<div class="flex ...">
<div class="hidden ...">01</div>
<div>02</div>
<div>03</div>
</div>
Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use hover:inline-flex
to only apply the inline-flex
utility on hover.
For a complete list of all available state modifiers, check out the documentation.
Breakpoints and media queries
You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use md:inline-flex
to apply the inline-flex
utility at only medium screen sizes and above.
<div class="flex md:inline-flex">
</div>