Título
Contenido con estilos automáticos
Tailwind CSS es el framework utility-first más popular. Aprende tips y trucos para usarlo como un profesional.
// tailwind.config.js
module.exports = {
content: ['./src/**/*.{html,js,jsx,ts,tsx}'],
theme: {
extend: {
colors: {
primary: {
50: '#eff6ff',
500: '#3b82f6',
900: '#1e3a8a'
}
},
fontFamily: {
sans: ['Inter', 'sans-serif']
},
spacing: {
'128': '32rem'
},
animation: {
'fade-in': 'fadeIn 0.5s ease-in'
},
keyframes: {
fadeIn: {
'0%': { opacity: '0' },
'100%': { opacity: '1' }
}
}
}
},
plugins: [
require('@tailwindcss/forms'),
require('@tailwindcss/typography')
]
};/* styles.css */
@layer components {
.btn {
@apply px-4 py-2 rounded font-semibold transition-colors;
}
.btn-primary {
@apply btn bg-blue-500 text-white hover:bg-blue-600;
}
.btn-secondary {
@apply btn bg-gray-200 text-gray-800 hover:bg-gray-300;
}
.card {
@apply bg-white rounded-lg shadow-md p-6;
}
}
Responsive width
Responsive text
// tailwind.config.js
module.exports = {
darkMode: 'class', // o 'media'
// ...
};
// Uso
Contenido con dark mode
// Toggle dark mode
function toggleDarkMode() {
document.documentElement.classList.toggle('dark');
}
Hover me
Custom sizes
Custom colors and sizes
Custom grid
Gradient background
Gradient text
⚙️
📍
💓
⬇️
Flex container
Grid container
Responsive grid
16:9 ratio
1:1 ratio
Custom ratio
Este texto será truncado con...
Este texto se limitará a 3 líneas
y mostrará... al final
// @tailwindcss/forms
// @tailwindcss/typography
Título
Contenido con estilos automáticos
// @tailwindcss/aspect-ratio
Tailwind CSS acelera el desarrollo y mantiene consistencia en el diseño. Con estos tips puedes aprovechar todo su potencial y crear interfaces modernas rápidamente.
Asistente Virtual
Descubre mi experiencia, proyectos y habilidades