Tailwind doesn’t include purpose-built grid classes out of the box, but grid layouts are simple to build using the existing Flexbox and width utilities.

Basic Grids

Use the existing Flexbox and percentage width utilities to construct basic grids.

Grids - 图1

Responsive Grids

Use the responsive variants of the width utilities to build responsive grid layouts.

Grids - 图2

all

Grids - 图3

sm

Grids - 图4

md

Grids - 图5

lg

Grids - 图6

xl

Grids - 图7

Mixed Column Sizes

Mix different percentage width utilities to build mixed size grids.

Grids - 图8

Wrapping Columns

Add flex-wrap to your column container to allow columns to wrap when they run out of room.

Grids - 图9

Column Spacing

Add a negative horizontal margin like -mx-2 to your column container and an equal horizontal padding like px-2 to each column to add gutters.

To prevent horizontal scrolling in full width layouts, add overflow-hidden to another parent container, or compensate for the negative margin with matching horizontal padding.

Grids - 图10

Automatic Column Widths

Use flex-1 instead of an explicit width on your columns to have them size automatically to fill the row.

Grids - 图11

Column Order

Use flex-row-reverse to reverse column order. Useful for two-column responsive layouts where the column on right should appear first on smaller screens.

Grids - 图12

Simple Offsets

Use auto margin utilities like ml-auto and mr-auto to offset columns in a row.

Grids - 图13