Quick reference for Tailwind CSS utility patterns, responsive design, and configuration.
This skill inherits all available tools. When active, it can use any tool Claude has access to.
Quick reference for Tailwind CSS utility patterns, responsive design, and configuration.
tailwind, utility classes, responsive design, tailwind config, dark mode css, tw classes
| Prefix | Min Width | CSS |
|---|---|---|
sm: | 640px | @media (min-width: 640px) |
md: | 768px | @media (min-width: 768px) |
lg: | 1024px | @media (min-width: 1024px) |
xl: | 1280px | @media (min-width: 1280px) |
2xl: | 1536px | @media (min-width: 1536px) |
Mobile-first: No prefix = mobile, add prefix for larger screens.
<div class="w-full md:w-1/2 lg:w-1/3">
<!-- Full width on mobile, half on tablet, third on desktop -->
</div>
<div class="container mx-auto px-4">
<!-- Centered with padding -->
</div>
<div class="flex items-center justify-between gap-4">
<div>Left</div>
<div>Right</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
<div>Card 1</div>
<div>Card 2</div>
<div>Card 3</div>
</div>
<div class="flex flex-col gap-4">
<div>Item 1</div>
<div>Item 2</div>
</div>
<div class="bg-white rounded-lg shadow-md p-6">
<h3 class="text-lg font-semibold mb-2">Title</h3>
<p class="text-gray-600">Content</p>
</div>
<!-- Primary -->
<button class="bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 transition-colors">
Primary
</button>
<!-- Secondary -->
<button class="bg-gray-200 text-gray-800 px-4 py-2 rounded-lg hover:bg-gray-300 transition-colors">
Secondary
</button>
<!-- Outline -->
<button class="border border-blue-600 text-blue-600 px-4 py-2 rounded-lg hover:bg-blue-50 transition-colors">
Outline
</button>
<input
type="text"
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"
placeholder="Enter text"
/>
// tailwind.config.js
module.exports = {
darkMode: 'class',
// ...
}
<!-- Add 'dark' class to html or parent -->
<div class="bg-white dark:bg-gray-900 text-gray-900 dark:text-white">
Content adapts to dark mode
</div>
// tailwind.config.js
module.exports = {
darkMode: 'media', // Uses prefers-color-scheme
// ...
}
// tailwind.config.js
module.exports = {
content: [
'./src/**/*.{js,ts,jsx,tsx,html}',
],
darkMode: 'class',
theme: {
extend: {
colors: {
brand: {
50: '#f0f9ff',
500: '#3b82f6',
900: '#1e3a8a',
},
},
fontFamily: {
sans: ['Inter', 'sans-serif'],
},
},
},
plugins: [],
}
| Class | Size |
|---|---|
p-0 | 0px |
p-1 | 4px (0.25rem) |
p-2 | 8px (0.5rem) |
p-4 | 16px (1rem) |
p-6 | 24px (1.5rem) |
p-8 | 32px (2rem) |
p-12 | 48px (3rem) |
p-16 | 64px (4rem) |
Same scale applies to: m-, gap-, w-, h-, space-x-, space-y-
When the scale doesn't have what you need:
<div class="w-[137px] h-[calc(100vh-64px)] top-[17px]">
<!-- Exact values when needed -->
</div>
| Modifier | Triggers On |
|---|---|
hover: | Mouse hover |
focus: | Element focused |
active: | Being clicked |
disabled: | Disabled state |
group-hover: | Parent hovered |
first: | First child |
last: | Last child |
odd: | Odd children |
even: | Even children |
<button class="bg-blue-500 hover:bg-blue-600 active:bg-blue-700 disabled:opacity-50">
Button
</button>
content arraycontentRecommended order for readability:
<div class="flex items-center | w-full p-4 | text-lg font-medium | bg-white border rounded-lg | hover:shadow-md">
<!-- Pipes are comments for organization -->
</div>