Tailwind CSS Cheat Sheet
Layout
- container: Responsive fixed-width container
- block / inline-block / inline: Display types
- flex / inline-flex: Enable flexbox
- grid: Enable grid layout
- hidden: Hide element
- w-* / h-*: Width / height (e.g. w-1/2, h-16)
- min-w-* / max-w-*: Min/max width
- overflow-auto / overflow-hidden: Scroll behavior
Spacing
- p-* / px-* / py-*: Padding (all / horizontal / vertical)
- m-* / mx-* / my-*: Margin (same as padding)
- space-x-* / space-y-*: Spacing between child elements
Colors
- bg-{color}-{shade}: Background color (e.g. bg-blue-500)
- text-{color}-{shade}: Text color
- border-{color}-{shade}: Border color
- hover:bg-* / hover:text-*: Hover variants
Typography
- text-xs to text-9xl: Font size
- font-thin to font-black: Font weight
- text-left / text-center / text-right: Text alignment
- uppercase / lowercase / capitalize: Text transform
- leading-*: Line height (e.g. leading-tight)
- tracking-*: Letter spacing
Flexbox & Grid
- flex-row / flex-col: Flex direction
- justify-*: Main axis alignment
- items-*: Cross axis alignment
- gap-*: Gap between grid/flex items
- grid-cols-*: Number of grid columns
- col-span-*: Grid column span
Position
- relative / absolute / fixed / sticky: Positioning types
- top-* / bottom-* / left-* / right-*: Offsets
- z-*: Z-index (stacking order)
Borders & Radius
- border: Adds border
- border-*: Border sides (e.g. border-l)
- rounded / rounded-*: Border radius
- divide-x-* / divide-y-*: Divider lines between children
Transitions & Animations
- transition: Enable transitions
- duration-*: Transition duration
- ease-*: Timing functions
- animate-*: Built-in animations (e.g. animate-pulse, animate-spin)
Responsive Prefixes
- sm: 640px
- md: 768px
- lg: 1024px
- xl: 1280px
- 2xl: 1536px