Краткая справка

Класс
Свойства
grid-flow-rowgrid-auto-flow: row;
grid-flow-colgrid-auto-flow: column;
grid-flow-densegrid-auto-flow: dense;
grid-flow-row-densegrid-auto-flow: row dense;
grid-flow-col-densegrid-auto-flow: column dense;

Основы использования

Управление размещением элементов сетки

Используйте утилиты grid-flow-{keyword} для управления работой алгоритма автоматического размещения для макета сетки.

01
02
03
04
05
<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.