A comprehensive cheatsheet for Tailwind CSS utility classes, perfect for quick reference during development. This guide includes commonly used utilities, responsive design patterns, and best practices for building modern user interfaces.
- 📱 Complete responsive design utilities
- 🎨 Comprehensive color system guide
- 📦 Layout and spacing references
- 🔤 Typography and text styling
- 🎯 Interactive state management
- 💡 Best practices and tips
- Official Tailwind Documentation
- Tailwind Play - Official Playground
- Tailwind UI - Component Library
- Installation & Setup
- Basic Configuration
- Layout
- Spacing
- Typography
- Backgrounds
- Borders
- Effects
- Interactivity
- Responsive Design
- Color System
- Tips & Best Practices
- Common UI Patterns
- Contributing
- License
TODO: Add comprehensive installation guide
# Install Tailwind CSS
npm install -D tailwindcss
# Initialize configuration file
npx tailwindcss init
// tailwind.config.js
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./src/**/*.{html,js}"],
theme: {
extend: {},
},
plugins: [],
}
block
- Block elementinline
- Inline elementinline-block
- Inline-block elementflex
- Flex containerinline-flex
- Inline flex containergrid
- Grid containerhidden
- Hide element
flex-row
- Direction: left to rightflex-col
- Direction: top to bottomflex-wrap
- Allow wrappingflex-nowrap
- Prevent wrappingjustify-start
- Justify: startjustify-end
- Justify: endjustify-center
- Justify: centerjustify-between
- Justify: space betweenitems-start
- Align items: startitems-center
- Align items: centeritems-end
- Align items: end
grid-cols-{1-12}
- Number of columnsgap-{size}
- Gap between grid itemscol-span-{1-12}
- Column spanrow-span-{1-6}
- Row span
m-{size}
- All sidesmt-{size}
- Topmr-{size}
- Rightmb-{size}
- Bottomml-{size}
- Leftmx-{size}
- Horizontalmy-{size}
- Vertical
p-{size}
- All sidespt-{size}
- Toppr-{size}
- Rightpb-{size}
- Bottompl-{size}
- Leftpx-{size}
- Horizontalpy-{size}
- Vertical
Size values: 0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 72, 80, 96
text-xs
- 0.75remtext-sm
- 0.875remtext-base
- 1remtext-lg
- 1.125remtext-xl
- 1.25remtext-2xl
- 1.5remtext-3xl
- 1.875remtext-4xl
- 2.25remtext-5xl
- 3rem
font-thin
- 100font-extralight
- 200font-light
- 300font-normal
- 400font-medium
- 500font-semibold
- 600font-bold
- 700font-extrabold
- 800font-black
- 900
text-left
- Left aligntext-center
- Center aligntext-right
- Right aligntext-justify
- Justify text
text-{color}-{shade}
- Text color- Example:
text-blue-500
,text-red-700
bg-{color}-{shade}
- Background color- Example:
bg-gray-100
,bg-blue-500
bg-auto
- Auto sizebg-cover
- Coverbg-contain
- Contain
bg-center
- Centerbg-top
- Topbg-bottom
- Bottombg-left
- Leftbg-right
- Right
border
- 1pxborder-0
- 0pxborder-2
- 2pxborder-4
- 4pxborder-8
- 8px
border-{color}-{shade}
- Border color- Example:
border-gray-200
,border-blue-500
rounded
- 0.25remrounded-sm
- 0.125remrounded-md
- 0.375remrounded-lg
- 0.5remrounded-xl
- 0.75remrounded-2xl
- 1remrounded-full
- 9999px
opacity-0
- 0opacity-25
- 0.25opacity-50
- 0.5opacity-75
- 0.75opacity-100
- 1
shadow-sm
- Smallshadow
- Defaultshadow-md
- Mediumshadow-lg
- Largeshadow-xl
- Extra largeshadow-2xl
- 2x extra largeshadow-none
- None
cursor-pointer
- Pointercursor-default
- Defaultcursor-not-allowed
- Not allowed
select-none
- Prevent selectionselect-text
- Allow selectionselect-all
- Select all
- Add
hover:
orfocus:
prefix to any utility - Example:
hover:bg-blue-700
,focus:outline-none
sm:
- 640pxmd:
- 768pxlg:
- 1024pxxl:
- 1280px2xl:
- 1536px
Example: md:flex-col
will apply flex-col at medium screens and above
Available colors with their shade variants (50-900):
gray
red
yellow
green
blue
indigo
purple
pink
Shade values:
- 50 (lightest)
- 100
- 200
- 300
- 400
- 500
- 600
- 700
- 800
- 900 (darkest)
-
Combining Utilities
<div class="flex items-center justify-between p-4 bg-blue-500 text-white">
-
Responsive Design
<div class="w-full md:w-1/2 lg:w-1/3">
-
State Variants
<button class="bg-blue-500 hover:bg-blue-700 focus:outline-none">
-
Custom Values
<div class="top-[117px]">
-
Organization
- Group related utilities together
- Put responsive utilities last
- Keep hover/focus states near their base utilities
TODO: Add frequently used UI patterns with code examples
- Responsive Navigation Bar
- Card Layouts
- Form Elements
- Hero Sections
- Footers
- Dropdown Menus
- Modal Windows
- Sidebar Layouts
- Data Tables
- Authentication Forms
tailwind-cheatsheet/
├── README.md
├── LICENSE
├── CONTRIBUTING.md
├── examples/
│ ├── components/
│ │ ├── buttons.md
│ │ ├── cards.md
│ │ ├── forms.md
│ │ └── navigation.md
│ └── layouts/
│ ├── grid-systems.md
│ ├── hero-sections.md
│ └── responsive-patterns.md
└── docs/
├── installation.md
├── configuration.md
└── customization.md
I welcome contributions! Please see the Contributing Guide for details.
- Adding new utility class examples
- Improving documentation
- Adding real-world use cases
- Fixing errors or typos
- Suggesting improvements
This project is licensed under the MIT License - see the LICENSE file for details.