-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotes.txt
430 lines (238 loc) · 9.4 KB
/
notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
bismillah to tailwind css
CSS Framework
this is better than bootstrap
almost noo need to write css in different files you can write inline css
Every class has work for single utility
no need to override css
fast development
OUTPUT CSS file banti hai dev kay wqt sirf necessary classes rehti hein baki wali css nahi jati development kay time server pe
lightwwight than other framkeworks
HOW TO INSTALL tailwind
CDN , with Node and Npm
Setup with CDN
just copy the script link and paste in head;
TAILWIND CSS core principle is utility first
2, SETUP TAILWIND CSS 4 WITH CLI
for that we need node and npm which comes with node i have already installed
first
npm install tailwindcss @tailwindcss/cli
after running the command kuch files downlaod hongi like nodemoudules
phir ek input.css file name se ek file banawo aur uskay andr ye paste karo
@import "tailwindcss";
then for output css file write this command in terminal
npx @tailwindcss/cli -i ./input.css -o ./output.css --watch
aur ye head mai import krna hai, jo bhe html file banaty ho
<link href="./output.css" rel="stylesheet">
output and input.css ka naam dusra bhe rakhskte ho
succsssfully installed tailwind css with cli
and understood output file
output file mai wo css jama hoti hai jo ap html file mai use krte ho instaed of whole tailwind package
FIRST STYLE WITH TAILWIND
to use tailwind first run this command
npx @tailwindcss/cli -i ./input.css -o ./output.css --watch
instead of write every time --WATCH command ill add this in package.json
NOTE : input aur output ka path dehan se do
[&>*]:flex ye parent mai lagengy toh ye propersties child lagnegy instend of har child pe lagany kay
3 WORKING WITH COLORS
shade har color kay sth milti sirf white aur black kay sth nahi milti
50 se 950 kay bich mai hein jo hein wo suggest mai milty hein wo defualt mai miltey hein baki khud customize karsktein hien
text-colorname-50-950
same for bg-color-name-50-950
🎨 Tailwind CSS Colors Notes
🌟 Background Colors
bg-{color}-{shade} → Element ka background color change karne ke liye
Example: bg-blue-500, bg-gray-900, bg-red-200
🎨 Text Colors
text-{color}-{shade} → Text ka color change karne ke liye
Example: text-red-500, text-green-700, text-gray-900
🖋 Border Colors
border-{color}-{shade} → Element ke border ka color change karne ke liye
border ki width bhi define ki ja sakti hai, jaise border-2 border-blue-500
🏷 Outline Colors
outline-{color}-{shade} → Focus ya interactive elements ke outline ka color set karne ke liye
Example: outline-blue-500, outline-green-700
🔄 Hover & Focus Effects
hover:{color} → Mouse hover pe color change karne ke liye
focus:{color} → Focus hone par color change karne ke liye
Example: hover:bg-blue-700, focus:text-red-500
🎭 Gradient Colors
bg-gradient-to-{direction} → Gradient background banane ke liye
from-{color}-{shade} → Gradient ka start color
to-{color}-{shade} → Gradient ka end color
Example: bg-gradient-to-r from-blue-500 to-purple-500
🌓 Dark Mode Colors
dark:{color} → Dark mode ke liye alag color set karne ke liye
Example: dark:bg-gray-800, dark:text-white
✅ Common Colors List
Neutral Colors: gray, slate, stone, zinc, neutral
Primary Colors: blue, red, green, yellow, purple, pink
Other Colors: cyan, teal, lime, amber, rose, violet, fuchsia, sky, indigo, orange
Shades Range: 50 (lightest) → 900 (darkest)
==========================================================
-----------------------------------------------------
MARGIN AND PADDING
📏 Tailwind CSS Margin & Padding Notes
🔹 Margin (Spacing Outside an Element)
m-{size} → All sides margin
mt-{size} → Top margin
mr-{size} → Right margin
mb-{size} → Bottom margin
ml-{size} → Left margin
mx-{size} → Horizontal (left & right) margin
my-{size} → Vertical (top & bottom) margin
Example: m-4, mt-6, mx-auto
🔥 Negative Margin
-m-{size} → Negative margin
Example: -mt-2, -ml-4
🔹 Padding (Spacing Inside an Element)
p-{size} → All sides padding
pt-{size} → Top padding
pr-{size} → Right padding
pb-{size} → Bottom padding
pl-{size} → Left padding
px-{size} → Horizontal (left & right) padding
py-{size} → Vertical (top & bottom) padding
Example: p-4, pt-6, px-8
📏 Available Sizes
0 → No spacing
1 → 4px
2 → 8px
3 → 12px
4 → 16px
5 → 20px
6 → 24px
8 → 32px
10 → 40px
12 → 48px
16 → 64px
20 → 80px
24 → 96px
32 → 128px
40 → 160px
48 → 192px
56 → 224px
64 → 256px
auto → Automatic margin (center align kaam me ata hai)
🎯 Special Margin & Padding Classes
mx-auto → Horizontally center an element
p-0 → No padding
m-0 → No margin
space-x-{size} → Child elements ke darmiyan horizontal gap
space-y-{size} → Child elements ke darmiyan vertical gap
🔹 Tailwind CSS Margin on <span> and Inline Elements
⚡ Issue: Why Margin Doesn’t Work on <span>?
<span> is an inline element → Inline elements ignore vertical margin (mt, mb won’t work).
Only horizontal margins (ml, mr) work → But it depends on surrounding content.
✅ How to Apply Margin on <span>?
1️⃣ Use inline-block or block
Convert <span> into inline-block or block, then all margin utilities will work.
Example: inline-block mt-4
2️⃣ Use ml-{size} and mr-{size}
Horizontal margin works on inline elements.
Example: ml-2 (adds left spacing), mr-4 (adds right spacing).
3️⃣ Use space-x-{size} for multiple inline elements
Works on child inline elements.
Example: space-x-4 on a parent div will add spacing between inline elements.
4️⃣ Use gap-{size} in flex/grid
If spans are inside a flexbox or grid, use gap-4 instead of margin.
⚠️ What WON’T Work?
🚫 mt-{size} and mb-{size} won’t work directly on <span>, unless you change display.
🔥 Quick Fix Examples:
✅ <span class="inline-block mt-4 ml-2">Text</span> → ✅ Works
✅ <div class="space-x-4"><span>Item 1</span><span>Item 2</span></div> → ✅ Works
✅ <div class="flex gap-4"><span>Item 1</span><span>Item 2</span></div> → ✅ Works
🚫 <span class="mt-4">Text</span> → ❌ Doesn’t work
================================================================
-----------------------------------------------------
📏 Tailwind CSS Width & Sizing (Min, Max, Full)
1️⃣ Width (w-{size})
w-0 → w-96 (Fixed width in rem)
w-px (1px width)
w-full (100% of parent)
w-screen (100% of viewport)
w-auto (Based on content)
w-1/2, w-1/3, w-2/3 … (Fractional widths)
w-10 (Spacing-based width, 2.5rem)
2️⃣ Min-Width (min-w-{size})
min-w-0 (No min-width)
min-w-full (100% of parent)
min-w-min (Shrink to fit)
min-w-max (Expand as needed)
3️⃣ Max-Width (max-w-{size})
max-w-none (No limit)
max-w-xs → max-w-7xl (Preset sizes)
max-w-full (100% of parent)
max-w-screen-sm/md/lg/xl/2xl (Relative to viewport)
4️⃣ Height (h-{size})
h-0 → h-96 (Fixed heights)
h-full (100% of parent)
h-screen (100% of viewport)
h-auto (Based on content)
h-1/2, h-1/3 … (Fractional heights)
5️⃣ Min-Height (min-h-{size})
min-h-0 (No min-height)
min-h-full (100% of parent)
min-h-screen (Full screen height)
6️⃣ Max-Height (max-h-{size})
max-h-full (100% of parent)
max-h-screen (100vh)
max-h-none (No limit)
💡 Pro Tips:
w-full h-screen = Fullscreen container
max-w-screen-lg = Restrict width to lg screen size
min-h-screen = Ensure minimum height covers the viewport
🔥 Use with Flex/Grid:
flex-grow, flex-shrink to make elements responsive
aspect-{ratio} for maintaining aspect ratio
===========================================================
============================================================
HEIGHT
📏 Tailwind CSS Height (Complete Guide)
1️⃣ Height (h-{size})
h-0 → h-96 (Fixed heights in rem)
h-px (1px height)
h-auto (Height based on content)
h-full (100% of parent)
h-screen (100vh → Full viewport height)
h-min (Shrink to fit content)
h-max (Expand as needed)
h-fit (Fit content height)
h-1/2, h-1/3, h-2/3 … (Fractional heights)
h-10 (Spacing-based height, 2.5rem)
2️⃣ Min-Height (min-h-{size})
min-h-0 (No min-height)
min-h-full (100% of parent)
min-h-screen (100vh → Full viewport height)
min-h-min (Shrink to fit content)
min-h-max (Expand as needed)
min-h-fit (Fit to content height)
3️⃣ Max-Height (max-h-{size})
max-h-full (100% of parent)
max-h-screen (100vh → Viewport height)
max-h-none (No limit, default behavior)
max-h-min (Minimum possible height)
max-h-max (Maximum allowed height)
max-h-fit (Fit content height)
4️⃣ Viewport-Based Heights (vh & percentages)
h-[50vh] → 50% of viewport height
h-[80%] → 80% of parent height
5️⃣ Aspect Ratio for Height Control (aspect-{ratio})
aspect-auto (Default)
aspect-square (1:1)
aspect-video (16:9)
6️⃣ Height with Flexbox/Grid
flex-grow (Grow to fill space)
flex-shrink (Shrink if needed)
h-auto inside flex container behaves responsively
🚀 Pro Tips
✅ h-screen for full-height sections
✅ min-h-screen for layouts where height should be at least viewport height
✅ h-auto for dynamic height elements
✅ max-h-screen for scrollable elements
✅ h-full with flex-grow to auto-fill space
🔥 For Dynamic Heights
Use h-auto for content-based height
Use min-h-screen for full-page layouts
Use max-h-screen for scrollable sections
=======================================================================
to set full height of parent element give class 'h-full' to parent and to child 'H-FULL' ab half kay liye 1/2 3,4,5,5... use karsktein hein