Flexbox & Grid
Utilities for controlling how elements in a grid are auto-placed.
Use the grid-flow-*
utilities to control how the auto-placement algorithm works for a grid layout.
<div class="grid grid-flow-row-dense grid-cols-3 grid-rows-3 ...">
<div class="col-span-2">01</div>
<div class="col-span-2">02</div>
<div>03</div>
<div>04</div>
<div>05</div>
</div>
Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use hover:grid-flow-row
to only apply the grid-flow-row
utility on hover.
<div class="grid grid-flow-col hover:grid-flow-row">
<!-- ... -->
</div>
For a complete list of all available state modifiers, check out the Hover, Focus, & Other States documentation.
You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use md:grid-flow-row
to apply the grid-flow-row
utility at only medium screen sizes and above.
<div class="grid grid-flow-col md:grid-flow-row">
<!-- ... -->
</div>
To learn more, check out the documentation on Responsive Design, Dark Mode and other media query modifiers.