Tailwind CSS
Custom Configuration
Extend the theme with custom colors, fonts, and animations.
By EZ4Code Team
configcustomization
Code
// tailwind.config.js
module.exports = {
content: ["./src/**/*.{html,js,ts,jsx,tsx}"],
theme: {
extend: {
colors: {
brand: {
50: "#eef6ff",
500: "#1976d2",
700: "#0d47a1"
}
},
fontFamily: {
sans: ["Inter", "system-ui", "sans-serif"]
},
spacing: {
128: "32rem"
},
animation: {
"fade-in": "fadeIn 0.3s ease-in"
},
keyframes: {
fadeIn: { "0%": { opacity: "0" }, "100%": { opacity: "1" } }
}
}
},
plugins: []
};Explanation
The config file customizes Tailwind via theme.extend, which adds to defaults without replacing them. Adding a brand color generates bg-brand-500, text-brand-700, and so on. The content array tells Tailwind which files to scan so it can purge unused utilities in production.
More Tailwind CSS Snippets
Utility Classes
Compose a button and card from atomic utilities.
Responsive Design
Apply per-breakpoint utilities with sm:, md:, and lg: prefixes.
Hover & Focus States
Style interactive states and group-hover with variant prefixes.
Flexbox & Grid
Center, distribute, and grid layouts with utilities.
Colors
Use the default palette, opacity modifiers, and gradients.
Spacing
Apply padding, margin, gap, and width/height from one scale.