تقنيات Tailwind CSS المتقدمة
ارتقِ بمهاراتك في Tailwind إلى ما بعد الأساسيات عبر الإعدادات والإضافات المخصّصة.
الإعداد المخصّص
// tailwind.config.js
module.exports = {
theme: {
extend: {
colors: {
brand: {
50: '#f0f9ff',
500: '#0ea5e9',
900: '#0c4a6e',
},
},
spacing: {
'128': '32rem',
'144': '36rem',
},
animation: {
'spin-slow': 'spin 3s linear infinite',
},
},
},
}
إنشاء إضافات مخصّصة
const plugin = require('tailwindcss/plugin')
module.exports = {
plugins: [
plugin(function({ addUtilities, theme }) {
addUtilities({
'.text-shadow': {
textShadow: '2px 2px 4px rgba(0,0,0,0.1)',
},
'.text-shadow-lg': {
textShadow: '4px 4px 8px rgba(0,0,0,0.2)',
},
})
}),
],
}
أنماط المكوّنات باستخدام apply@
/* styles/components.css */
@layer components {
.btn-primary {
@apply px-4 py-2 bg-brand-500 text-white rounded-lg
hover:bg-brand-600 transition-colors;
}
.card {
@apply bg-white rounded-xl shadow-lg p-6;
}
}
أنماط التصميم المتجاوب
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4">
<div class="col-span-1 lg:col-span-2">Featured</div>
</div>
أتقِن هذه التقنيات لبناء أنظمة تصميم قابلة للتوسّع مع Tailwind CSS.
التعليقات (0)
اترك تعليقًا
لا توجد تعليقات بعد. كن أول من يشارك أفكاره!