Tailwind CSS Cheatsheet
Complete Tailwind CSS v3 reference — 300+ utility classes across 12 categories, full color palette, and responsive prefixes. Search and copy any class instantly.
356 entries
Color Palette — Click to Copy Class
Use as text-{color}-{shade}, bg-{color}-{shade}, border-{color}-{shade}, etc. Click a swatch to copy the class.
max-width: 100%; padding: 0 1rem (responsive)Responsive container that centers contentdisplay: blockBlock-level elementdisplay: inlineInline elementdisplay: inline-blockInline block elementdisplay: flexBlock-level flex containerdisplay: inline-flexInline flex containerdisplay: gridBlock-level grid containerdisplay: inline-gridInline grid containerdisplay: noneHide element completelydisplay: tableTable displaydisplay: contentsChildren act as if the parent does not existposition: staticDefault — follows normal document flowposition: relativePositioned relative to itselfposition: absoluteRemoved from flow, positioned relative to nearest positioned ancestorposition: fixedRemoved from flow, positioned relative to viewportposition: stickyRelative until scroll threshold, then fixedoverflow: autoScroll when content overflowsoverflow: hiddenClip content that overflowsoverflow: visibleContent is not clipped (default)overflow: scrollAlways show scrollbarsoverflow-x: autoHorizontal scroll when neededoverflow-y: autoVertical scroll when neededz-index: 0Z-index 0z-index: 10Z-index 10z-index: 20Z-index 20z-index: 30Z-index 30z-index: 40Z-index 40z-index: 50Z-index 50z-index: autoZ-index auto (default stacking context)float: leftFloat element to the leftfloat: rightFloat element to the rightfloat: noneRemove floatclear: leftClear left floatsclear: rightClear right floatsclear: bothClear all floatstop: 0; right: 0; bottom: 0; left: 0Set all sides to 0 (fill parent when absolute/fixed)top/right/bottom/left: 0Position an edge at 0top: 100%Position top at 100% of parent heightisolation: isolateCreate a new stacking contextflex-direction: rowMain axis: horizontal (default)flex-direction: row-reverseMain axis: horizontal, reversedflex-direction: columnMain axis: verticalflex-direction: column-reverseMain axis: vertical, reversedflex-wrap: wrapItems wrap onto multiple linesflex-wrap: wrap-reverseItems wrap in reverse directionflex-wrap: nowrapItems stay on one line (default)justify-content: flex-startAlign items at start of main axisjustify-content: flex-endAlign items at end of main axisjustify-content: centerCenter items along main axisjustify-content: space-betweenSpace between items, edges flushjustify-content: space-aroundEqual space around each itemjustify-content: space-evenlyEqual space between all items including edgesalign-items: flex-startCross-axis align: startalign-items: flex-endCross-axis align: endalign-items: centerCross-axis align: centeralign-items: baselineCross-axis align: text baselinealign-items: stretchCross-axis align: stretch to fill (default)align-content: flex-startPack rows at start (multi-line)align-content: centerPack rows at center (multi-line)align-content: space-betweenSpace between rows (multi-line)align-self: autoInherit parent align-itemsalign-self: flex-startOverride alignment for this item: startalign-self: flex-endOverride alignment for this item: endalign-self: centerOverride alignment for this item: centeralign-self: stretchOverride alignment for this item: stretchflex: 1 1 0%Grow and shrink equally; ignore content sizeflex: 1 1 autoGrow and shrink from natural sizeflex: 0 1 autoShrink but do not grow (default)flex: noneRigid — does not grow or shrinkflex-grow: 1Allow item to growflex-grow: 0Prevent item from growingflex-shrink: 1Allow item to shrink (default)flex-shrink: 0Prevent item from shrinkingorder: -9999Move item to the visual startorder: 9999Move item to the visual endorder: 0Natural order (default)gap: 1remGap between flex/grid items (4 = 1rem)column-gap / row-gap: 1remAxis-specific gapgrid-template-columns: repeat(N, minmax(0, 1fr))N equal-width columnsgrid-template-columns: noneNo column definitiongrid-template-rows: repeat(N, minmax(0, 1fr))N equal-height rowsgrid-column: autoAuto-placed columngrid-column: span N / span NColumn span of Ngrid-column: 1 / -1Span all columnsgrid-column-start: NStart at column line Ngrid-column-end: NEnd at column line Ngrid-row: span N / span NRow span of Ngrid-row: 1 / -1Span all rowsplace-items: centerCenter items on both axesplace-items: startAlign items at start on both axesplace-content: centerCenter tracks in both dimensionsgrid-auto-columns: autoAuto-sized implicit columnsgrid-auto-columns: minmax(0, 1fr)Fractional implicit columnsgrid-auto-rows: autoAuto-sized implicit rowsgrid-auto-rows: minmax(0, 1fr)Fractional implicit rowsgrid-auto-flow: rowFill rows first (default)grid-auto-flow: columnFill columns firstgrid-auto-flow: denseFill gaps by backfillingpadding: 0px … 24remPadding on all sides (scale × 4px)padding-left: 1rem; padding-right: 1remHorizontal padding (left + right)padding-top: 1rem; padding-bottom: 1remVertical padding (top + bottom)padding-top/right/bottom/left: 1remSingle-side paddingmargin: 0px … 24remMargin on all sidesmargin-left: auto; margin-right: autoCenter horizontallymargin-top: 1rem; margin-bottom: 1remVertical marginmargin-top/right/bottom/left: 1remSingle-side marginmargin: -1remNegative margin (pulls element outward)margin-left: 1rem (on children, not first)Horizontal gap between children via marginmargin-top: 1rem (on children, not first)Vertical gap between children via marginpadding: 0pxAll-sides padding — 0 × 4px = 0pxpadding: 2pxAll-sides padding — 0.5 × 4px = 2pxpadding: 4pxAll-sides padding — 1 × 4px = 4pxpadding: 6pxAll-sides padding — 1.5 × 4px = 6pxpadding: 8pxAll-sides padding — 2 × 4px = 8pxpadding: 10pxAll-sides padding — 2.5 × 4px = 10pxpadding: 12pxAll-sides padding — 3 × 4px = 12pxpadding: 16pxAll-sides padding — 4 × 4px = 16pxpadding: 20pxAll-sides padding — 5 × 4px = 20pxpadding: 24pxAll-sides padding — 6 × 4px = 24pxpadding: 32pxAll-sides padding — 8 × 4px = 32pxpadding: 40pxAll-sides padding — 10 × 4px = 40pxpadding: 48pxAll-sides padding — 12 × 4px = 48pxpadding: 64pxAll-sides padding — 16 × 4px = 64pxpadding: 80pxAll-sides padding — 20 × 4px = 80pxpadding: 96pxAll-sides padding — 24 × 4px = 96pxpadding: 128pxAll-sides padding — 32 × 4px = 128pxwidth: autoNatural width (default)width: 100%Full width of parentwidth: 100vwFull viewport widthwidth: min-contentShrink to minimum content widthwidth: max-contentExpand to fit contentwidth: fit-contentFit content up to parent widthwidth: 50%Half the parent widthwidth: 33.333% / 66.667%Third-based widthswidth: 25% / 75%Quarter-based widthswidth: 0px … 24remFixed width values (scale × 4px)height: autoNatural heightheight: 100%Full height of parentheight: 100vhFull viewport heightheight: 100dvhDynamic viewport height (handles mobile browser chrome)height: 0px … 24remFixed height valuesmin-width: 0Allow flex items to shrink below content sizemin-width: 100%Minimum full widthmax-width: 384px … 1280pxNamed max-width breakpointsmax-width: 100%No wider than parentmax-width: 65chOptimal reading width (~65 characters)min-height: 0Remove default minimum heightmin-height: 100%At least full parent heightmin-height: 100vhAt least full viewport heightaspect-ratio: autoNatural aspect ratio (default)aspect-ratio: 1 / 1Square aspect ratioaspect-ratio: 16 / 916:9 widescreen ratiofont-size: 0.75rem; line-height: 1remExtra small — 12pxfont-size: 0.875rem; line-height: 1.25remSmall — 14pxfont-size: 1rem; line-height: 1.5remBase — 16px (default)font-size: 1.125rem; line-height: 1.75remLarge — 18pxfont-size: 1.25rem; line-height: 1.75remXL — 20pxfont-size: 1.5rem; line-height: 2rem2XL — 24pxfont-size: 1.875rem; line-height: 2.25rem3XL — 30pxfont-size: 2.25rem; line-height: 2.5rem4XL — 36pxfont-size: 3rem; line-height: 15XL — 48pxfont-size: 3.75rem; line-height: 16XL — 60pxfont-size: 4.5rem; line-height: 17XL — 72pxfont-size: 6rem; line-height: 18XL — 96pxfont-size: 8rem; line-height: 19XL — 128pxfont-weight: 100Hairline weightfont-weight: 200Extra-light weightfont-weight: 300Light weightfont-weight: 400Normal / regular weight (default)font-weight: 500Medium weightfont-weight: 600Semi-bold weightfont-weight: 700Bold weightfont-weight: 800Extra-bold weightfont-weight: 900Heaviest / black weightfont-family: ui-sans-serif, system-ui, …System sans-serif stackfont-family: ui-serif, Georgia, …System serif stackfont-family: ui-monospace, SFMono-Regular, …Monospace stackline-height: 1Tight / no leadingline-height: 1.25Tight line heightline-height: 1.375Snug line heightline-height: 1.5Normal line heightline-height: 1.625Relaxed line height (good for body copy)line-height: 2Loose / very open line heightletter-spacing: -0.05emVery tight letter spacingletter-spacing: -0.025emTight letter spacingletter-spacing: 0emNormal letter spacing (default)letter-spacing: 0.025emWide letter spacingletter-spacing: 0.05emWider letter spacingletter-spacing: 0.1emWidest letter spacingtext-align: leftLeft-align texttext-align: centerCenter texttext-align: rightRight-align texttext-align: justifyJustify texttext-align: startLogical start (LTR: left)text-align: endLogical end (LTR: right)text-decoration-line: underlineUnderline texttext-decoration-line: line-throughStrikethrough texttext-decoration-line: noneRemove text decorationtext-transform: uppercaseUPPERCASE texttext-transform: lowercaselowercase texttext-transform: capitalizeCapitalize First Lettertext-transform: noneRemove text transformoverflow: hidden; text-overflow: ellipsis; white-space: nowrapTruncate overflowing text with ellipsistext-overflow: ellipsisEllipsis overflow (needs overflow: hidden)white-space: nowrapPrevent text from wrappingwhite-space: prePreserve whitespace and newlineswhite-space: pre-wrapPreserve whitespace, wrap at line breaksoverflow-wrap: break-wordBreak long words to prevent overflowword-break: break-allBreak at any characterfont-style: italicItalic textfont-style: normalNormal (non-italic) text-webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscaleSmooth font renderingcolor: inheritInherit color from parentcolor: currentColorUse current CSS color valuecolor: transparentTransparent text (useful for gradients)background-color: transparentTransparent backgroundbackground-color: inheritInherit background from parentbackground-color: currentColorUse current color as backgroundbackground-color: #fff / #000Pure white or black backgroundbackground-color: <color>Named color background, e.g. bg-blue-500background-opacity: 0.550% background opacity (deprecated in v3.x — use bg-blue-500/50)background-color: rgb(59 130 246 / 0.5)Background with opacity modifierbackground-image: linear-gradient(to right, var(--tw-gradient-stops))Right-direction gradientbackground-image: linear-gradient(to left, …)Left-direction gradientbackground-image: linear-gradient(to top, …)Upward gradientbackground-image: linear-gradient(to bottom, …)Downward gradientbackground-image: linear-gradient(to top right / …)Diagonal gradient directions--tw-gradient-from: #3b82f6Gradient start color--tw-gradient-via: #a855f7Gradient midpoint color--tw-gradient-to: #ec4899Gradient end colorbackground-size: coverScale to cover entire containerbackground-size: containScale to fit inside containerbackground-size: autoNatural background sizebackground-position: centerCenter background imagebackground-position: top / bottomPosition background at top or bottombackground-repeat: no-repeatNo background repeatbackground-repeat: repeat / repeat-x / repeat-yRepeat background imagebackground-attachment: fixedBackground fixed to viewport (parallax)border-width: 1px1px border on all sidesborder-width: 0pxRemove borderborder-width: 2px / 4px / 8pxThicker bordersborder-top/right/bottom/left-width: 1pxSingle-side 1px borderborder-left + border-right / border-top + border-bottomHorizontal or vertical bordersborder-color: <color>Named color border, e.g. border-gray-200border-style: solidSolid border style (default)border-style: dashedDashed border styleborder-style: dottedDotted border styleborder-style: noneRemove border styleborder-radius: 0No border radiusborder-radius: 0.125rem2px radius — subtleborder-radius: 0.25rem4px radius — defaultborder-radius: 0.375rem6px radius — common for cardsborder-radius: 0.5rem8px radius — pronouncedborder-radius: 0.75rem12px radius — largeborder-radius: 1rem16px radius — very largeborder-radius: 1.5rem24px radius — hugeborder-radius: 9999pxPill / circle shapeborder-radius on top/bottom cornersPartial radius by sideborder-top-left/top-right-radius: 0.5remSingle corner radiusoutline: 2px solid transparent; outline-offset: 2pxRemove focus outline (use ring instead)box-shadow: 0 0 0 Npx var(--tw-ring-color)Focus ring using box-shadowbox-shadow: inset 0 0 0 Npx …Ring on inside of element--tw-ring-color: <color>Ring color, e.g. ring-blue-500border on children (not first)Dividers between children using borderborder-color: <color>Divider colorbox-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05)Subtle shadowbox-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)Default shadowbox-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), …Medium shadowbox-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), …Large shadowbox-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), …XL shadowbox-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25)2XL shadow — dramaticbox-shadow: 0 0 #0000Remove shadowbox-shadow: inset 0 2px 4px 0 rgb(0 0 0 / 0.05)Inner shadow (pressed effect)--tw-shadow-color: <color>Colored shadow, e.g. shadow-blue-500/50opacity: 0Fully transparentopacity: 0.25 / 0.5 / 0.75Partial opacityopacity: 1Fully opaque (default)filter: blur(4px)Small blurfilter: blur(8px)Default blurfilter: blur(12px … 64px)Larger blursfilter: blur(0)Remove blurfilter: drop-shadow(…)Drop shadow (follows shape, not box)filter: brightness(0.5 … 1.5)Adjust brightnessfilter: contrast(0.5 … 1.5)Adjust contrastfilter: grayscale(100%)Full grayscalefilter: invert(100%)Invert colorsfilter: saturate(N)Adjust color saturationmix-blend-mode: multiply / screen / overlayBlend mode with element belowbackdrop-filter: blur(…)Blur backdrop (frosted glass)backdrop-filter: brightness(N)Adjust backdrop brightnesstransition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150msDefault transition on common propertiestransition-property: all; …Transition all propertiestransition-property: color, background-color, border-color, …Transition color-related properties onlytransition-property: opacity; …Transition opacity onlytransition-property: transform; …Transition transform onlytransition-property: noneDisable transitionstransition-duration: 75ms … 1000msTransition durationtransition-timing-function: linearLinear easing — constant speedtransition-timing-function: cubic-bezier(0.4, 0, 1, 1)Ease in — starts slowtransition-timing-function: cubic-bezier(0, 0, 0.2, 1)Ease out — ends slowtransition-timing-function: cubic-bezier(0.4, 0, 0.2, 1)Ease in-out — slow at both ends (default)transition-delay: 75ms … 1000msTransition start delayanimation: noneRemove animationanimation: spin 1s linear infiniteContinuous spin — loading indicatorsanimation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinitePing/ripple — notification badgesanimation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infiniteFade in/out — skeleton loadersanimation: bounce 1s infiniteBounce up and downtransform: scaleX(N) scaleY(N)Scale transformtransform: rotate(Ndeg)Rotate transformtransform: translateX(1rem) / translateY(1rem)Translate on X or Y axistransform: skewX(1deg) / skewY(1deg)Skew transformtransform-origin: center / top / …Transform origin pointcursor: autoBrowser decides cursor (default)cursor: defaultArrow cursorcursor: pointerPointer / hand cursor — for clickable elementscursor: waitSpinning/busy cursorcursor: textText insertion cursorcursor: moveMove cursorcursor: not-allowedBlocked action cursorcursor: grab / grabbingDrag handle cursorpointer-events: noneIgnore all mouse eventspointer-events: autoRestore mouse events (default)user-select: nonePrevent text selectionuser-select: textAllow text selectionuser-select: allSelect all on clickuser-select: autoDefault selection behaviorresize: nonePrevent resizing (e.g. textarea)resize: bothAllow resize in both directionsresize: horizontal / verticalRestrict resize directionscroll-behavior: smoothSmooth scrollingscroll-behavior: autoInstant scrolling (default)scroll-margin / scroll-padding: 1remAdjust scroll snap offsetscroll-snap-align: start / center / endScroll snap alignmentscroll-snap-type: x / y / both mandatoryEnable scroll snappingtouch-action: none / pan-x / pan-yControl touch/pointer behaviorappearance: noneRemove native browser styling (e.g. custom select)outline: none / 1px solid / 2px solidFocus outline controlbox-shadow: 0 0 0 2px … (on :focus)Focus ring — use instead of outline-none for accessibility@media (min-width: 640px) { … }Apply from 640px (≥ small screens)@media (min-width: 768px) { … }Apply from 768px (≥ medium screens)@media (min-width: 1024px) { … }Apply from 1024px (≥ large screens)@media (min-width: 1280px) { … }Apply from 1280px (≥ extra-large)@media (min-width: 1536px) { … }Apply from 1536px (≥ 2x extra-large)&:hover { … }Apply on mouse hover&:focus { … }Apply on keyboard focus&:focus-within { … }Apply when any child is focused&:focus-visible { … }Apply only on keyboard focus (not mouse click)&:active { … }Apply while being clicked&:disabled { … }Apply to disabled form elements.group:hover & { … }Apply when parent .group is hovered.peer:checked ~ & { … }Apply when sibling .peer is checked@media (prefers-color-scheme: dark) { … }Dark mode variant@media print { … }Print media variant@media (prefers-reduced-motion: no-preference / reduce) { … }Respect user motion preferences:first-child / :last-child / :nth-child(odd) / :nth-child(even)Child position variantse.g. w-[37px] or text-[#ff6600]Arbitrary value using square bracket syntaxFrequently Asked Questions
What version of Tailwind does this cheatsheet cover?
This cheatsheet covers Tailwind CSS v3, which is the most widely deployed version. Tailwind v3 introduced JIT (Just-In-Time) compilation, arbitrary value syntax (e.g. w-[37px]), and numerous new utilities like aspect-ratio, backdrop-blur, and scroll-snap classes.
How does the Tailwind color palette work?
Tailwind v3 ships with 22 color families (slate, gray, zinc, neutral, stone, red, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, fuchsia, pink, rose). Each color has 11 shades from 50 (lightest) to 950 (darkest). Apply any color with a prefix like bg-, text-, border-, ring-, shadow-, from-, via-, to-.
What is the Tailwind spacing scale?
Tailwind's default spacing scale maps numbers to rem values where each unit equals 4px (0.25rem). So p-4 is 1rem (16px), m-8 is 2rem (32px), and so on. The scale includes fractional values (0.5, 1.5, 2.5, 3.5) and goes up to 96 (24rem / 384px). You can use arbitrary values like p-[17px] or m-[3.5rem] for any value not in the scale.
How do responsive prefixes work in Tailwind?
Tailwind uses a mobile-first approach. Breakpoints are min-width: sm (640px), md (768px), lg (1024px), xl (1280px), 2xl (1536px). A class without a prefix applies at all sizes. A class with a prefix like md:flex applies only when the viewport is 768px or wider. You can stack prefixes: sm:flex lg:grid applies flex from 640px and switches to grid at 1024px.
What is the arbitrary value syntax in Tailwind?
Square brackets let you use any CSS value that is not in Tailwind's scale: w-[37px], text-[#ff6600], bg-[url('/img.png')], grid-cols-[1fr_2fr_1fr]. This works with nearly every utility. Use underscores inside brackets to represent spaces in CSS values. Arbitrary values are compiled with JIT and do not bloat your CSS if unused.