Building CSS Grids in TailwindCSS v1.2

Published under TailwindCSS

Support for CSS grids has been added to Tailwind v1.2. Here's a little example:

Example

Row 1, Column 1
Row 1, Column 2, Span 2
Row 2, Start 2, End 4
Row 3, Start 1, End 4
Row 4, Start 2, End 5

Tailwind provides support for a lot of CSS grid properties out of the box, but a lot of them don't have default values. The default values are based around a 12-column grid.

gap-*

Default values for gap are the spacing values setup in your configuration (same as margin, padding, etc).

theme('spacing')

---

row-gap-*

There are no default values for the row-gap classes.

---

col-gap-*

There are no default values for the column gap classes.

---

grid-cols-*

The grid-cols-* sets the grid-template-columns and is used on the grid wrapper to tell the grid how many columns it should support. Default values:

none: 'none',
'1': 'repeat(1, minmax(0, 1fr))',
'2': 'repeat(2, minmax(0, 1fr))',
'3': 'repeat(3, minmax(0, 1fr))',
'4': 'repeat(4, minmax(0, 1fr))',
'5': 'repeat(5, minmax(0, 1fr))',
'6': 'repeat(6, minmax(0, 1fr))',
'7': 'repeat(7, minmax(0, 1fr))',
'8': 'repeat(8, minmax(0, 1fr))',
'9': 'repeat(9, minmax(0, 1fr))',
'10': 'repeat(10, minmax(0, 1fr))',
'11': 'repeat(11, minmax(0, 1fr))',
'12': 'repeat(12, minmax(0, 1fr))',

---

col-*

The col-* class sets the grid-column property, and tells the element how many columns it should span across. Default values:

auto: 'auto',
'span-1': 'span 1 / span 1',
'span-2': 'span 2 / span 2',
'span-3': 'span 3 / span 3',
'span-4': 'span 4 / span 4',
'span-5': 'span 5 / span 5',
'span-6': 'span 6 / span 6',
'span-7': 'span 7 / span 7',
'span-8': 'span 8 / span 8',
'span-9': 'span 9 / span 9',
'span-10': 'span 10 / span 10',
'span-11': 'span 11 / span 11',
'span-12': 'span 12 / span 12',

---

col-start-* / col-end-*

The col-start-* and col-end-* sets the grid-column-start and grid-column-end properties on the element. These tell the element where which column to start and end at, respectively. Default values:

'1': '1',
'2': '2',
'3': '3',
'4': '4',
'5': '5',
'6': '6',
'7': '7',
'8': '8',
'9': '9',
'10': '10',
'11': '11',
'12': '12',
'13': '13',

---

grid-rows-*

The grid-rows-* sets the grid-template-rows on the element, and is used on the grid wrapper to tell the element how many rows are in the grid. There are no default values.

---

row-*

The row-* sets the grid-row property on the element, telling it which rows to occupy. There are no default values.

---

row-start-* / row-end-*

The row-start-* and row-end-* sets the grid-row-start and grid-row-end properties on the element. These tell the element where which row to start and end at, respectively. There are no default values.

Be sure to read the full TailwindCSS documentation!