Home / CSS The Tailwind Cheat Sheet By Flavio Copes
Jul 9, 2018 updated Sep 13, 2026 A Tailwind CSS 4 cheat sheet mapping the CSS properties you use most, like margin, padding, width, colors, and flexbox, to their matching utility classes.
~~~
I wrote this cheat sheet because I find myself constantly referencing the Tailwind docs to remind a particular class.
This version matches Tailwind CSS 4 . If you still need to wire the build, see how to set up Tailwind .
Here are the things I use the most.
Margin and Padding
Compose those 3 tables. Add a dash before the value (e.g. pt-2, m-auto)
In Tailwind 4, spacing utilities are driven by a single --spacing scale (0.25rem per step). So p-4 is 1rem, and odd values like p-7 work without extending the config.
Symbol Description pPadding mMargin -mNegative margin
Symbol Description t Top r Right b Bottom l Left x Horizontal y Vertical
Value Description 0 00.5 0.125rem1 0.25rem1.5 0.375rem2 0.5rem2.5 0.625rem3 0.75rem3.5 0.875rem4 1rem5 1.25rem6 1.5rem7 1.75rem8 2rem9 2.25rem10 2.5rem11 2.75rem12 3rem14 3.5rem16 4rem20 5rem24 6rem28 7rem32 8rem36 9rem40 10rem44 11rem48 12rem52 13rem56 14rem60 15rem64 16rem72 18rem80 20rem96 24rempx 1pxauto auto
margin: 0 auto
I sometimes use margin: 0 auto to center things.
The class mx-auto applies it.
Width
Class CSS w-1 width: 0.25remw-2 width: 0.5remw-3 width: 0.75remw-4 width: 1remw-6 width: 1.5remw-8 width: 2remw-10 width: 2.5remw-12 width: 3remw-16 width: 4remw-24 width: 6remw-32 width: 8remw-48 width: 12remw-64 width: 16remw-96 width: 24remw-auto width: autow-px width: 1pxw-1/2 width: 50%w-1/3 width: 33.33333%w-2/3 width: 66.66667%w-1/4 width: 25%w-3/4 width: 75%w-1/5 width: 20%w-2/5 width: 40%w-3/5 width: 60%w-4/5 width: 80%w-1/6 width: 16.66667%w-5/6 width: 83.33333%w-full width: 100%w-screen width: 100vww-svw width: 100svww-dvw width: 100dvw
Max Width
Class CSS max-w-xs max-width: 20remmax-w-sm max-width: 24remmax-w-md max-width: 28remmax-w-lg max-width: 32remmax-w-xl max-width: 36remmax-w-2xl max-width: 42remmax-w-3xl max-width: 48remmax-w-4xl max-width: 56remmax-w-5xl max-width: 64remmax-w-6xl max-width: 72remmax-w-7xl max-width: 80remmax-w-prose max-width: 65chmax-w-full max-width: 100%max-w-none max-width: none
Min width
Class CSS min-w-0 min-width: 0min-w-full min-width: 100%min-w-min min-width: min-contentmin-w-max min-width: max-contentmin-w-fit min-width: fit-content
Free · no paywall
Learn to build software with AI
6 free courses on AI agents, skills, MCP and running models locally. Then 81 more on the fundamentals AI-written code still depends on, plus 17 books and 222 browser tools. All free.
Start with the AI courses → Font Family
Class CSS font-sans font-family: ui-sans-serif, system-ui, sans-serif, ...font-serif font-family: ui-serif, Georgia, Cambria, "Times New Roman", Times, seriffont-mono font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, ...
Font Size
Class CSS text-xs font-size: 0.75remtext-sm font-size: 0.875remtext-base font-size: 1remtext-lg font-size: 1.125remtext-xl font-size: 1.25remtext-2xl font-size: 1.5remtext-3xl font-size: 1.875remtext-4xl font-size: 2.25remtext-5xl font-size: 3remtext-6xl font-size: 3.75remtext-7xl font-size: 4.5remtext-8xl font-size: 6remtext-9xl font-size: 8rem
Font weight
Class CSS font-thin font-weight: 100font-extralight font-weight: 200font-light font-weight: 300font-normal font-weight: 400font-medium font-weight: 500font-semibold font-weight: 600font-bold font-weight: 700font-extrabold font-weight: 800font-black font-weight: 900
Colors
Tailwind 4 ships a modern palette. Common color names:
red, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, fuchsia, pink, rose
Neutrals: slate, gray, zinc, neutral, stone
Plus black, white, transparent, current
Every color has shades from -50 (lightest) up to -950 (darkest):
orange-50
orange-100
orange-200
…
orange-900
orange-950
Text color
Prepend text- to any color, for example text-blue-600
Background color
Prepend bg- to any color, for example bg-zinc-100
Center text
Use text-center
Line Height
Class CSS leading-none line-height: 1leading-tight line-height: 1.25leading-snug line-height: 1.375leading-normal line-height: 1.5leading-relaxed line-height: 1.625leading-loose line-height: 2
Flexbox
Container
Class CSS flex display: flexinline-flex display: inline-flex
Items
Direction
Class CSS flex-row flex-direction: rowflex-row-reverse flex-direction: row-reverseflex-col flex-direction: columnflex-col-reverse flex-direction: column-reverse
Wrapping
Class CSS flex-nowrap flex-wrap: nowrapflex-wrap flex-wrap: wrapflex-wrap-reverse flex-wrap: wrap-reverse
Align items
Class CSS items-stretch align-items: stretchitems-start align-items: flex-startitems-center align-items: centeritems-end align-items: flex-enditems-baseline align-items: baseline
Align content
Class CSS content-start align-content: flex-startcontent-center align-content: centercontent-end align-content: flex-endcontent-between align-content: space-betweencontent-around align-content: space-aroundcontent-evenly align-content: space-evenly
Align self
Class CSS self-auto align-self: autoself-start align-self: flex-startself-center align-self: centerself-end align-self: flex-endself-stretch align-self: stretch
Justify content
Class CSS justify-start justify-content: flex-startjustify-center justify-content: centerjustify-end justify-content: flex-endjustify-between justify-content: space-betweenjustify-around justify-content: space-aroundjustify-evenly justify-content: space-evenly
Flex, grow, shrink
Class CSS flex-initial flex: 0 autoflex-1 flex: 1flex-auto flex: autoflex-none flex: nonegrow flex-grow: 1grow-0 flex-grow: 0shrink flex-shrink: 1shrink-0 flex-shrink: 0
Modifiers
Hover
hover:, for example hover:bg-blue-600
Want me to talk about your product? You can sponsor this site .
Free ebook
Enjoyed this? Grab my CSS Handbook for free. Subscribe to my newsletter and download it, together with all my other programming books, courses, and software.
Download the CSS Handbook → ~~~
Related posts about css: