@fwkui/x-css 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,2361 +1,103 @@
1
- # Hướng dẫn sử dụng x-css
1
+ # Fwkui XCSS
2
2
 
3
- `x-css` một thư viện CSS-JavaScript nhỏ gọn hiệu quả để xây dựng giao diện người dùng phản ứng (reactive user interfaces). Thư viện này cung cấp các công cụ để quản trạng thái (state management) thao tác với DOM một cách tự động và hiệu quả.
3
+ XCSS la thu vien tao CSS tu class viet tat. Ban chi can viet class tren HTML/React, thu vien se tu dong sinh rule va dua vao `adoptedStyleSheets`. Tai lieu nay giup ban nho nhanh key -> property -> value de viet class dung ngay.
4
4
 
5
5
  ## Cài đặt
6
-
7
- Để sử dụng `x-css`, bạn chỉ cần import nó vào dự án của mình:
8
-
9
- ```html
10
- <script type="module">
11
- import $ from "https://unpkg.com/@fwkui/x-css@1.0.2/index.js";
12
- $.cssObserve(document);
13
- </script>
14
- ```
15
-
16
- # Hướng dẫn sử dụng xCSS
17
-
18
- xCSS là một hệ thống CSS-in-JS cho phép bạn viết CSS ngắn gọn và hiệu quả thông qua các class name đặc biệt. Sau khi học, bạn sẽ:
19
-
20
- - Đọc/viết class theo công thức và hiểu nó biến thành CSS như thế nào
21
- - Kiểm soát **media query**, **@layer**, **!important**, **selector** giả (pseudo) và tổ hợp nhiều thuộc tính trong **một class**
22
-
23
- > **Lưu ý**: Danh sách viết tắt thuộc tính và giá trị sẽ có ở **phía dưới**.
24
- ## Thiết kế mới: Design Tokens (CSS Variables)
25
-
26
- - Mục đích: Giảm độ dài và phức tạp của giá trị CSS trong các class, đảm bảo nhất quán branding và dễ bảo trì khi màu sắc, spacing, shadow, gradient… thay đổi.
27
- - Cách khai báo:
28
- - Đặt các biến trong thẻ style ở đầu tài liệu hoặc trong một file CSS được import trước khi dùng xCSS.
29
- - Dùng cú pháp CSS biến bắt đầu bằng --, ví dụ: --bg-gradient-login, --panel, --shadow-card, --color-primary, --spacing-md, …
30
- - Cách dùng trong xCSS:
31
- - Dùng trực tiếp qua braces: bg{var(--bg-gradient-login)} hoặc bxsh{var(--shadow-card)} hoặc p{var(--spacing-md)}.
32
- - Dùng alias có sẵn để biến đổi nhanh: bgc--panel hoặc c--primary (nếu có alias tương ứng với token).
33
- - Có thể có fallback bằng var(--name, fallbackValue) để tương thích với trình duyệt cũ.
34
- - Lưu ý: CSS biến phải được load trước khi render các class dùng biến đó.
35
-
36
- - Ví dụ khai báo tokens (thêm vào đầu tài liệu hoặc một file style được import sớm):
37
- ```html
38
- <style>
39
- :root {
40
- --bg-gradient-login: linear-gradient(#6a11cb, #2575fc);
41
- --panel: #ffffff;
42
- --shadow-card: 0 10px 20px rgba(0,0,0,.15);
43
- --radius-card: 12px;
44
- --color-primary: #0070f3;
45
- --space-md: 16px;
46
- }
47
- </style>
48
- ```
49
- - Ví dụ dùng token trong trang login:
50
- ```html
51
- <body class="bg{var(--bg-gradient-login)} h100vh w100% dF jcC aiC">
52
- <main class="w360px md:w420px lg:w480px bgcWhite p28px bxsh{var(--shadow-card)} bdra12px">
53
- ...
54
- <button class="w100% p12px cWhite bdN bdra8px bxsh{var(--shadow-card)}" style="--color-primary: #0070f3;">
55
- Đăng nhập
56
- </button>
57
- </main>
58
- </body>
59
- ```
60
- - Gợi ý migrates và alias:
61
- - Nếu có alias như bgc--panel hoặc c--primary, bạn có thể định nghĩa token tương ứng và sử dụng đồng thời.
62
- - Ví dụ: :root { --panel: #fff; } và dùng bgc--panel hoặc bgc{var(--panel)} tùy cách build.
63
-
64
- - Xem thêm trong phần ví dụ và trang Design Tokens dưới đây để tham khảo cách tích hợp.
65
-
66
- ## Cú pháp tổng quát
67
-
68
- ```
69
- [MQ:][layer]<property><value>[@selector]
70
- ```
71
-
72
- **Lưu ý quan trọng**: `<property><value>` là **bắt buộc** - phải có cả thuộc tính CSS và giá trị CSS.
73
-
74
- **Ví dụ cú pháp đúng:**
75
-
76
- - `cRed` - Màu đỏ (layer 0)
77
- - `5cRed` - Màu đỏ ở layer 5
78
- - `md:cRed` - Màu đỏ trên màn hình trung bình
79
- - `md:5cRed` - Màu đỏ ở layer 5 trên màn hình trung bình
80
-
81
- ### Các thành phần:
82
-
83
- #### 1. Media Query (MQ) - Tùy chọn
84
-
85
- - `xs:` - Màn hình nhỏ (max-width: 575px)
86
- - `sm:` - Màn hình nhỏ (min-width: 576px)
87
- - `md:` - Màn hình trung bình (min-width: 768px)
88
- - `lg:` - Màn hình lớn (min-width: 992px)
89
- - `xl:` - Màn hình rất lớn (min-width: 1200px)
90
- - `2xl:` - Màn hình cực lớn (min-width: 1400px)
91
- - `sma:` - Màn hình nhỏ trở xuống (max-width: 768px)
92
- - `mda:` - Màn hình trung bình trở xuống (max-width: 992px)
93
- - `lga:` - Màn hình lớn trở xuống (max-width: 1200px)
94
- - `xla:` - Màn hình rất lớn trở xuống (max-width: 1400px)
95
-
96
- #### 2. Layer - Tùy chọn
97
-
98
- - `1` đến `19` - Thứ tự ưu tiên CSS layer (số càng cao ưu tiên càng cao)
99
- - Mặc định: `0` (layer 0)
100
- - Mục đích: gom nhóm quy tắc theo tầng (base, component, utilities, overrides…)
101
-
102
- #### 3. Property (Thuộc tính) - **BẮT BUỘC**
103
-
104
- - Viết thường, có thể là tên đầy đủ hoặc viết tắt
105
- - Không có dấu `-` trừ trường hợp có thuộc tính có dấu trừ thường bắt đầu `-w`
106
- - Ví dụ: `w` (width), `h` (height), `c` (color), `bg` (background)
107
-
108
- #### 4. Value (Giá trị) - **BẮT BUỘC**
109
-
110
- - **Số**: `10`, `-4.5`, `0.5`, có thể kèm **đơn vị**: `10px`, `1.5rem`, `100%`
111
- - **Giá trị đặt tên** bắt đầu bằng **chữ hoa**: `Red`, `Center`, `Block`, `Fixed`, `None`
112
- - **Giá trị trong ngoặc nhọn** để ghi **nguyên văn**: `c{rgb(255,0,0)}`, `bg{linear-gradient(...)}`
113
- - **Biến CSS**: bắt đầu bằng `--`: `c--primary` → `color: var(--primary)`
114
- - **Quan trọng**: thêm `!` ngay trước giá trị để ra `!important`: `w!10px` → `width: 10px !important`
115
- - **Hàm**: dùng dạng **TitleCase** + `(...)` và dùng dấu `;` thay cho khoảng trắng:
116
- - `wCalc(100%;-;20px)` → `width: calc(100% - 20px)`
117
- - `tTranslate(50%;,;-50%)` → `transform: translate(50% , -50%)`
118
-
119
- #### 5. Selector - Tùy chọn
120
-
121
- - Bắt đầu bằng `@`
122
- - Dấu `;` thay thế cho dấu cách
123
- - Có thể dùng giả lớp/giả phần tử, chọn phần tử con, hoặc kết hợp
124
- - Ví dụ: `@:hover`, `@:focus`, `@:active`, `@>a`, `@.btn;:hover`
125
-
126
- ## Ví dụ sử dụng
127
-
128
- ### Cơ bản
129
-
130
- ```html
131
- <!-- Màu đỏ -->
132
- <div class="cRed">Văn bản màu đỏ</div>
133
-
134
- <!-- Chiều rộng 100px -->
135
- <div class="w100px">Chiều rộng 100px</div>
136
-
137
- <!-- Padding 20px -->
138
- <div class="p20px">Padding 20px</div>
139
-
140
- <!-- Opacity 50% -->
141
- <div class="opc50%">Độ trong suốt 50%</div>
142
-
143
- <!-- Font size 14px -->
144
- <div class="fns14px">Cỡ chữ 14px</div>
145
- ```
146
-
147
- ### Với Media Query
148
-
149
- ```html
150
- <!-- Màu đỏ trên màn hình lớn -->
151
- <div class="lg:cRed">Màu đỏ trên desktop</div>
152
-
153
- <!-- Ẩn trên màn hình nhỏ -->
154
- <div class="xs:vHidden">Ẩn trên mobile</div>
155
-
156
- <!-- Responsive width -->
157
- <div class="w100% md:w50% lg:w33%">Responsive width</div>
158
- ```
159
-
160
- ### Với Layer
161
-
162
- ```html
163
- <!-- Layer ưu tiên cao -->
164
- <div class="5cRed">Màu đỏ ưu tiên cao</div>
165
-
166
- <!-- Layer ưu tiên thấp -->
167
- <div class="1cBlue">Màu xanh ưu tiên thấp</div>
168
-
169
- <!-- Kết hợp layer và media query -->
170
- <div class="md:7cGreen">Màu xanh layer 7 trên desktop</div>
171
- ```
172
-
173
- ### Với Selector
174
-
175
- ```html
176
- <!-- Hover effect -->
177
- <div class="cRed@:hover">Đỏ khi hover</div>
178
-
179
- <!-- Focus effect -->
180
- <input class="bdw2px@:focus" placeholder="Border khi focus" />
181
-
182
- <!-- Child selector -->
183
- <div class="cBlue@>a">Màu xanh cho thẻ con a</div>
184
-
185
- <!-- Complex selector -->
186
- <div class="cRed@.btn;:hover">Màu đỏ khi hover button</div>
187
- ```
188
-
189
- ### Với giá trị đặc biệt
190
-
191
- ```html
192
- <!-- !important -->
193
- <div class="c!red">Màu đỏ !important</div>
194
-
195
- <!-- CSS Variable -->
196
- <div class="c--primary">Màu từ CSS variable</div>
197
-
198
- <!-- Giá trị tùy chỉnh -->
199
- <div class="w{calc(100%;-;20px)}">Chiều rộng tính toán</div>
200
-
201
- <!-- Hàm CSS -->
202
- <div class="wClamp(280px;640px;100%)">Width với clamp</div>
203
-
204
- <!-- Box shadow phức tạp -->
205
- <div class="bxsh{0;2px;8px;rgba(0,0,0,.1)}">Shadow phức tạp</div>
206
- ```
207
-
208
- ### Kết hợp nhiều thuộc tính với `&`
209
-
210
- ```html
211
- <!-- Nhiều thuộc tính cùng lúc -->
212
- <div class="cRed&fw700&taC">Màu đỏ, font-weight 700, căn giữa</div>
213
-
214
- <!-- Flexbox layout -->
215
- <div class="dF&aiC&jcSp">Flexbox center và space-between</div>
216
-
217
- <!-- Padding và margin -->
218
- <div class="p8px&m0">Padding 8px và margin 0</div>
219
-
220
- <!-- Kết hợp với selector -->
221
- <div class="cRed&fw700@:hover">Màu đỏ và font-weight 700 khi hover</div>
222
- ```
223
-
224
- ## Quy tắc ưu tiên & va chạm
225
-
226
- 1. **@layer**: lớp số lớn thắng lớp số nhỏ (khi cùng nguồn gốc/specificity)
227
- 2. **Specificity** của selector: selector cụ thể hơn thắng
228
- 3. **Thứ tự xuất hiện** trong cùng layer và cùng specificity
229
- 4. **!important** luôn thắng các quy tắc thường trong cùng phạm vi cascade
230
-
231
- Ví dụ: `5cBlue` vs `9cRed` → `9cRed` thắng. Nhưng `5cBlue!` (viết `c!Blue` hoặc `c!{blue}`) có thể tiếp tục thắng nếu cùng layer/scope.
232
-
233
- ## Quy tắc quan trọng
234
-
235
- ### ✅ Hợp lệ
236
-
237
- - `cRed` - Màu đỏ (property: `c`, value: `Red`)
238
- - `w10px` - Chiều rộng 10px (property: `w`, value: `10px`)
239
- - `md:cRed` - Màu đỏ trên màn hình trung bình (MQ: `md`, property: `c`, value: `Red`)
240
- - `2w100px` - Chiều rộng 100px ở layer 2 (layer: `2`, property: `w`, value: `100px`)
241
- - `cRed@:hover` - Màu đỏ khi hover (property: `c`, value: `Red`, selector: `@:hover`)
242
- - `w!100px` - Chiều rộng 100px !important (property: `w`, value: `!100px`)
243
- - `c{red}` - Màu đỏ với giá trị tùy chỉnh (property: `c`, value: `{red}`)
244
- - `cRed&w700` - Kết hợp nhiều thuộc tính (property: `c`, value: `Red`, property: `w`, value: `700`)
245
- - `wCalc(100%;-;20px)` - Hàm CSS với dấu `;` (property: `w`, value: `Calc(100%;-;20px)`)
246
-
247
- ### ❌ Không hợp lệ
248
-
249
- - `Cred` - Chữ C viết hoa ở thuộc tính (property phải viết thường)
250
- - `C{red}` - Chữ C viết hoa ở thuộc tính (property phải viết thường)
251
- - `cRed}` - Thiếu dấu mở ngoặc (syntax lỗi)
252
- - `c-red` - Dấu gạch ngang không được phép (property không được có dấu `-`)
253
- - `W-10px` - Chữ W viết hoa và dấu gạch ngang (property phải viết thường)
254
- - `w-!10px` - Dấu gạch ngang không được phép (property không được có dấu `-`)
255
- - `cRed @:hover` - Có dấu cách trong class name (không được có dấu cách)
256
- - `c` - Thiếu value (bắt buộc phải có cả property và value)
257
- - `Red` - Thiếu property (bắt buộc phải có cả property và value)
258
-
259
- ## Lỗi phổ biến & cách tránh
260
-
261
- - **Dùng chữ hoa ở đầu thuộc tính** → sai. Thuộc tính (**property**) phải là **chữ thường** hoặc `--var`
262
- - **Thiếu property hoặc value** → sai. Cả hai đều **bắt buộc** phải có
263
- - **Nhầm dấu `-` và `!`**: `w-!10px` là lỗi. Hãy dùng `w!10px`
264
- - **Quên `;` trong giá trị có khoảng trắng**: `ff{Courier New}` → nên viết `ff{Courier;New}`
265
- - **Selector có khoảng trắng** phải dùng `;` và sẽ được đổi lại khi xuất
266
- - **Không có bảng viết tắt** → trình biên dịch không biết dịch `ta` thành `text-align`
267
-
268
- ## Lưu ý
269
-
270
- 1. **Property và Value bắt buộc** - Mỗi class phải có cả thuộc tính và giá trị CSS
271
- 2. **Tên class phải viết thường** - Chỉ property viết thường, value có thể có ký tự HOA
272
- 3. **Không dùng dấu cách** - Dùng dấu `;` thay thế
273
- 4. **CSS.supports validation** - Tất cả class phải được CSS hỗ trợ
274
- 5. **Thứ tự ưu tiên** - Layer số cao hơn sẽ có ưu tiên cao hơn
275
- 6. **Media Query** - Chỉ áp dụng trong khoảng màn hình tương ứng
276
- 7. **Khoảng trắng trong giá trị** dùng dấu `;`. Ví dụ: `ff{Courier;New;monospace}` → `font-family: Courier New, monospace`
277
-
278
- ## Lời khuyên từ kinh nghiệm thực tế
279
-
280
- ### 🎯 **Nguyên tắc đặt tên class**
281
-
282
- #### ✅ **Nên làm:**
283
-
284
- - **Ngắn gọn, dễ đọc**: `cRed`, `w100px`, `p16px`
285
- - **Sử dụng viết tắt chuẩn**: `dF` thay vì `displayFlex` (d: display, F: Flex)
286
-
287
- #### ❌ **Tránh:**
288
-
289
- - **Tên quá dài**: `wCalc(100%;-;20px;-;30px;-;10px)` → nên dùng CSS variable
290
- - **Giá trị phức tạp**: `bxsh{0;4px;8px;12px;rgba(0,0,0,0.1);inset}` → nên định nghĩa qua biến
291
- - **Thuộc tính lặp lại**: `cRed`, `cBlue`, `cGreen` → nên dùng color palette
292
-
293
- ### 🎨 **Quản lý giá trị phức tạp**
294
-
295
- #### **Sử dụng CSS Variables cho giá trị dài:**
296
-
297
- ```css
298
- :root {
299
- --shadow-card: 0 4px 8px rgba(0, 0, 0, 0.1);
300
- --shadow-hover: 0 8px 16px rgba(0, 0, 0, 0.15);
301
- --border-radius: 8px;
302
- --spacing-sm: 8px;
303
- --spacing-md: 16px;
304
- --spacing-lg: 24px;
305
- }
306
- ```
307
-
308
- ```html
309
- <!-- Thay vì viết dài -->
310
- <div class="bxsh{0;4px;8px;rgba(0,0,0,0.1)} bdra8px p16px">
311
- <!-- Nên dùng biến -->
312
- <div class="bxsh--shadow-card bdra--border-radius p--spacing-md"></div>
313
- </div>
314
- ```
315
-
316
- #### **Tạo component classes cho pattern thường dùng:**
317
-
318
- ```html
319
- <!-- Thay vì lặp lại nhiều lần -->
320
- <div class="dF&aiC&jcSp&p16px&bgcWhite&bxsh{0;2px;4px;rgba(0,0,0,0.1)}">
321
- <!-- Nên tạo component class -->
322
- <div class="card"></div>
323
- </div>
324
- ```
325
-
326
- ### 📱 **Responsive Design Best Practices**
327
-
328
- #### **Sử dụng mobile-first approach:**
329
-
330
- ```html
331
- <!-- Base styles cho mobile -->
332
- <div class="w100% p8px">
333
- <!-- Override cho desktop -->
334
- <div class="md:w50% md:p16px lg:w33% lg:p24px"></div>
335
- </div>
336
- ```
337
-
338
- #### **Nhóm breakpoints logic:**
339
-
340
- ```html
341
- <!-- Layout chính -->
342
- <div class="dB md:dF">
343
- <!-- Spacing responsive -->
344
- <div class="p8px md:p16px lg:p24px">
345
- <!-- Typography responsive -->
346
- <div class="fns14px md:fns16px lg:fns18px"></div>
347
- </div>
348
- </div>
349
- ```
350
-
351
- ### 🎭 **Layer Management**
352
-
353
- #### **Tổ chức layers theo hierarchy:**
354
-
355
- ```html
356
- <!-- Base styles (0) -->
357
- <div class="cBlack fns16px">
358
- <!-- Component styles (1-5) -->
359
- <div class="2btnPrimary">
360
- <!-- Utility styles (6-10) -->
361
- <div class="8m16px">
362
- <!-- Override styles (11-19) -->
363
- <div class="15cRed"></div>
364
- </div>
365
- </div>
366
- </div>
367
- ```
368
-
369
- ### 🔧 **Performance Tips**
370
-
371
- #### **Tránh over-engineering:**
372
-
373
- ```html
374
- <!-- Đơn giản và hiệu quả -->
375
- <div class="dF&aiC&p16px">
376
- <!-- Thay vì phức tạp không cần thiết -->
377
- <div class="dF&aiC&jcC&p16px&m0&b0&bgcT"></div>
378
- </div>
379
- ```
380
-
381
- #### **Sử dụng shorthand khi có thể:**
382
-
383
- ```html
384
- <!-- Margin shorthand -->
385
- <div class="m16px">
386
- <!-- margin: 16px -->
387
- <div class="mt8px&mb8px">
388
- <!-- margin-top: 8px; margin-bottom: 8px -->
389
-
390
- <!-- Padding shorthand -->
391
- <div class="p16px">
392
- <!-- padding: 16px -->
393
- <div class="px16px&py8px"><!-- padding: 8px 16px --></div>
394
- </div>
395
- </div>
396
- </div>
397
- ```
398
-
399
- ### 🎨 **Design System Integration**
400
-
401
- #### **Tạo design tokens:**
402
-
403
- ```css
404
- :root {
405
- /* Colors */
406
- --color-primary: #0070f3;
407
- --color-secondary: #7928ca;
408
- --color-success: #0070f3;
409
- --color-warning: #f5a623;
410
- --color-error: #e00;
411
-
412
- /* Spacing scale */
413
- --space-1: 4px;
414
- --space-2: 8px;
415
- --space-3: 12px;
416
- --space-4: 16px;
417
- --space-5: 20px;
418
- --space-6: 24px;
419
-
420
- /* Typography scale */
421
- --text-xs: 12px;
422
- --text-sm: 14px;
423
- --text-base: 16px;
424
- --text-lg: 18px;
425
- --text-xl: 20px;
426
- }
427
- ```
428
-
429
- #### **Sử dụng semantic naming:**
430
-
431
- ```html
432
- <!-- Thay vì màu cụ thể -->
433
- <div class="cBlue">
434
- <!-- Nên dùng semantic -->
435
- <div class="cPrimary">
436
- <div class="cSuccess">
437
- <div class="cError"></div>
438
- </div>
439
- </div>
440
- </div>
441
- ```
442
-
443
- ### 🚀 **Maintenance Tips**
444
-
445
- #### **Documentation cho team:**
446
-
447
- ```html
448
- <!-- Component: Button Primary -->
449
- <!-- Usage: <button class="btnPrimary">Click me</button> -->
450
- <!-- Variants: btnSecondary, btnDanger, btnGhost -->
451
- <button class="btnPrimary">Click me</button>
452
- ```
453
-
454
- #### **Consistent naming convention:**
455
-
456
- ```html
457
- <!-- Layout -->
458
- <div class="container">
459
- <div class="row">
460
- <div class="col">
461
- <!-- Components -->
462
- <div class="card">
463
- <div class="btn">
464
- <div class="input">
465
- <!-- Utilities -->
466
- <div class="textCenter">
467
- <div class="mAuto">
468
- <div class="dNone"></div>
469
- </div>
470
- </div>
471
- </div>
472
- </div>
473
- </div>
474
- </div>
475
- </div>
476
- </div>
477
- ```
478
-
479
- ### 💡 **Pro Tips**
480
-
481
- 1. **Luôn test trên mobile trước** - Mobile-first approach
482
- 2. **Sử dụng browser dev tools** - Kiểm tra CSS output
483
- 3. **Tạo style guide** - Document các pattern thường dùng
484
- 4. **Code review** - Đảm bảo consistency trong team
485
- 5. **Performance monitoring** - Theo dõi CSS bundle size
486
- 6. **Accessibility first** - Luôn nghĩ đến người dùng khuyết tật
487
-
488
- ## Ví dụ tổng hợp
489
-
490
- **HTML**
491
-
492
- ```html
493
- <div
494
- class="md:7 dF&aiC&jcSp p16px bgc--panel bxsh{0;2px;8px;rgba(0,0,0,.1)} c--fg@>a;:hover"
495
- >
496
- <a class="cBlue wClamp(120px;240px;100%)">Link</a>
497
- <button class="w!120px h40px bdra8px cWhite bgc#0070f3">Nút</button>
498
- </div>
499
- ```
500
-
501
- **CSS (phát sinh ý tưởng)**
502
-
503
- ```css
504
- @media (min-width: 768px) {
505
- @layer l7 {
506
- .md\:7\.dF\&aiC\&jcSp\:where(*) {
507
- display: flex;
508
- align-items: center;
509
- justify-content: space-between;
510
- padding: 16px;
511
- background-color: var(--panel);
512
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
513
- }
514
- .md\:7\.c\-\-fg\@\>a\;\:hover > a:hover {
515
- color: var(--fg);
516
- }
517
- .md\:7\.wClamp\(120px\;240px\;100\%\) {
518
- width: clamp(120px, 240px, 100%);
519
- }
520
- }
521
- }
522
- .cBlue {
523
- color: blue;
524
- }
525
- .w\!120px {
526
- width: 120px !important;
527
- }
528
- .h40px {
529
- height: 40px;
530
- }
531
- .bdra8px {
532
- border-radius: 8px;
533
- }
534
- .cWhite {
535
- color: #fff;
536
- }
537
- .bgc\#0070f3 {
538
- background-color: #0070f3;
539
- }
540
- ```
541
-
542
- ## Bảng tra cứu nhanh
543
-
544
- ### Media Query
545
-
546
- | Ký hiệu | Kích thước màn hình |
547
- | ------- | ------------------- |
548
- | `xs:` | ≤ 575px |
549
- | `sm:` | ≥ 576px |
550
- | `md:` | ≥ 768px |
551
- | `lg:` | ≥ 992px |
552
- | `xl:` | ≥ 1200px |
553
- | `2xl:` | ≥ 1400px |
554
-
555
- ### Layer
556
-
557
- | Ký hiệu | Mô tả |
558
- | ------- | ---------------------------------------------- |
559
- | `0` | Layer mặc định (ưu tiên thấp) |
560
- | `1-19` | Layer tùy chỉnh (số càng cao ưu tiên càng cao) |
561
-
562
- ### Giá trị đặc biệt
563
-
564
- | Ký hiệu | Ý nghĩa |
565
- | ------- | ----------------- |
566
- | `!` | !important |
567
- | `--` | CSS Variable |
568
- | `{}` | Giá trị tùy chỉnh |
569
- | `;` | Thay thế dấu cách |
570
-
571
- ## Câu hỏi thường gặp (FAQ)
572
-
573
- **Hỏi:** Tại sao phải viết hoa chữ cái đầu giá trị dạng từ khoá?
574
-
575
- **Đáp:** Để phân biệt **p** (thuộc tính viết thường) và **v** (giá trị đặt tên). Tránh nhầm `red` (giá trị) với một thuộc tính giả định.
576
-
577
- **Hỏi:** Dùng dấu gì cho khoảng trắng?
578
-
579
- **Đáp:** Dùng dấu `;` trong **giá trị** và **selector** để không phá vỡ tên class.
580
-
581
- **Hỏi:** Tôi muốn thêm breakpoint mới?
582
-
583
- **Đáp:** Bổ sung mã tiền tố (ví dụ `xxl:`) và map sang `@media (min-width: …)` trong cấu hình biên dịch.
584
-
585
- **Hỏi:** Có cần escape khi viết trong HTML?
586
-
587
- **Đáp:** Không. Bạn viết thô như quy ước. Bộ biên dịch sẽ escape khi phát sinh CSS.
588
-
589
- ---
590
-
591
- # Bảng tra cứu đầy đủ thuộc tính và giá trị xCSS
592
-
593
- ## Cấu trúc dữ liệu
594
-
595
- - **Viết tắt**: Ký hiệu ngắn gọn để sử dụng trong class
596
- - **Thuộc tính CSS**: Tên đầy đủ của thuộc tính CSS
597
- - **Giá trị viết tắt**: Mapping từ ký hiệu sang giá trị CSS (nếu có)
598
-
599
- ---
600
-
601
- ## 1. Layout & Display
602
-
603
- ### Display
604
-
605
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
606
- | -------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
607
- | `d` | `display` | `b:block`, `ib:inline-block`, `i:inline`, `f:flex`, `if:inline-flex`, `t:table`, `it:inline-table`, `tcp:table-caption`, `tcell:table-cell`, `tcol:table-column`, `tcolg:table-column-group`, `tfg:table-footer-group`, `thg:table-header-group`, `trg:table-row-group`, `tr:table-row`, `fr:flow-root`, `g:grid`, `ig:inline-grid`, `c:contents`, `li:list-item` |
608
-
609
- ### Position
610
-
611
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
612
- | -------- | ---------- | -------------------------------------------------------------- |
613
- | `pos` | `position` | `s:static`, `f:fixed`, `a:absolute`, `r:relative`, `st:sticky` |
614
-
615
- ### Sizing
616
-
617
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
618
- | -------- | ----------------- | ---------------------------------------------------------------- |
619
- | `w` | `width` | `mic:min-content`, `mac:max-content`, `fc:fit-content`, `f:100%` |
620
- | `h` | `height` | `mic:min-content`, `mac:max-content`, `fc:fit-content` |
621
- | `mw` | `max-width` | - |
622
- | `mxw` | `max-width` | - |
623
- | `mh` | `max-height` | - |
624
- | `miw` | `min-width` | `f:100%`, `mic:min-content`, `mac:max-content`, `fc:fit-content` |
625
- | `mih` | `min-height` | `f:100%`, `mic:min-content`, `mac:max-content`, `fc:fit-content` |
626
- | `blks` | `block-size` | - |
627
- | `ins` | `inline-size` | - |
628
- | `mbs` | `max-block-size` | - |
629
- | `mis` | `max-inline-size` | - |
630
- | `mibs` | `min-block-size` | - |
631
- | `misz` | `min-inline-size` | - |
632
-
633
- ### Positioning
634
-
635
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
636
- | -------- | -------------------- | ---------------- |
637
- | `t` | `top` | - |
638
- | `r` | `right` | - |
639
- | `b` | `bottom` | - |
640
- | `l` | `left` | - |
641
- | `i` | `inset` | - |
642
- | `iblk` | `inset-block` | - |
643
- | `ibe` | `inset-block-end` | - |
644
- | `ibsta` | `inset-block-start` | - |
645
- | `ii` | `inset-inline` | - |
646
- | `iie` | `inset-inline-end` | - |
647
- | `iis` | `inset-inline-start` | - |
648
-
649
- ---
650
-
651
- ## 2. Spacing
652
-
653
- ### Margin
654
-
655
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
656
- | -------- | --------------------- | ---------------- |
657
- | `m` | `margin` | - |
658
- | `mt` | `margin-top` | - |
659
- | `mr` | `margin-right` | - |
660
- | `mb` | `margin-bottom` | - |
661
- | `ml` | `margin-left` | - |
662
- | `mblk` | `margin-block` | - |
663
- | `mbe` | `margin-block-end` | - |
664
- | `mbsta` | `margin-block-start` | - |
665
- | `min` | `margin-inline` | - |
666
- | `mie` | `margin-inline-end` | - |
667
- | `mista` | `margin-inline-start` | - |
668
-
669
- ### Padding
670
-
671
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
672
- | -------- | ---------------------- | ---------------------------------------------------------- |
673
- | `p` | `padding` | - |
674
- | `pt` | `padding-top` | - |
675
- | `pr` | `padding-right` | - |
676
- | `pb` | `padding-bottom` | - |
677
- | `pl` | `padding-left` | - |
678
- | `pblk` | `padding-block` | - |
679
- | `pbe` | `padding-block-end` | - |
680
- | `pbs` | `padding-block-start` | - |
681
- | `pi` | `padding-inline` | `s:start`, `c:center`, `e:end`, `b:baseline`, `st:stretch` |
682
- | `pie` | `padding-inline-end` | - |
683
- | `pis` | `padding-inline-start` | - |
684
-
685
- ---
686
-
687
- ## 3. Colors & Background
688
-
689
- ### Color
690
-
691
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
692
- | -------- | ---------- | ---------------------------- |
693
- | `c` | `color` | `i:inherit`, `t:transparent` |
694
-
695
- ### Background
696
-
697
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
698
- | -------- | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
699
- | `bg` | `background` | - |
700
- | `bgc` | `background-color` | `t:transparent`, `c:currentcolor` |
701
- | `bgi` | `background-image` | - |
702
- | `bgp` | `background-position` | `t:top`, `b:bottom`, `l:left`, `r:right`, `c:center`, `lt:left top`, `ct:center top`, `rt:right top`, `lc:left center`, `cc:center center`, `rc:right center`, `lb:left bottom`, `cb:center bottom`, `rb:right bottom` |
703
- | `bgpx` | `background-position-x` | `l:left`, `r:right`, `c:center` |
704
- | `bgpy` | `background-position-y` | `t:top`, `b:bottom`, `c:center` |
705
- | `bgr` | `background-repeat` | `r:repeat`, `x:repeat-x`, `y:repeat-y`, `s:space`, `rn:round`, `n:no-repeat`, `rs: repeat space`, `rr:repeat repeat`, `nr:no-repeat round` |
706
- | `bgs` | `background-size` | `c:contain` |
707
- | `bga` | `background-attachment` | `s:scroll`, `f:fixed`, `l:local` |
708
- | `bgbm` | `background-blend-mode` | `n:normal`, `m:multiply`, `s:screen`, `o:overlay`, `d:darken`, `l:lighten`, `cd:color-dodge`, `i:color-burn`, `hl:hard-light`, `sl:soft-light`, `di:difference`, `e:exclusion`, `h:hue`, `sa:saturation`, `c:color`, `lu:luminosity` |
709
- | `bgcl` | `background-clip` | `bb:border-box`, `pb:padding-box`, `cb:content-box`, `t:text` |
710
- | `bgo` | `background-origin` | `bb:border-box`, `pb:padding-box`, `cb:content-box` |
711
-
712
- ---
713
-
714
- ## 4. Border
715
-
716
- ### Border General
717
-
718
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
719
- | -------- | -------------- | ------------------------------------------------------------------------------------------------- |
720
- | `bd` | `border` | `d:dotted`, `ds:dashed`, `db:double`, `g:groove`, `r:ridge`, `i:inset`, `o:outset` |
721
- | `bds` | `border-style` | `dt:dotted`, `ds:dashed`, `s:solid`, `db:double`, `g:groove`, `r:ridge`, `in:inset`, `out:outset` |
722
- | `bdc` | `border-color` | - |
723
- | `bdw` | `border-width` | `t:thin`, `m:medium`, `th:thick` |
724
-
725
- ### Border Sides
726
-
727
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
728
- | -------- | --------------- | ---------------- |
729
- | `bdt` | `border-top` | - |
730
- | `bdr` | `border-right` | - |
731
- | `bdb` | `border-bottom` | - |
732
- | `bdl` | `border-left` | - |
733
-
734
- ### Border Radius
735
-
736
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
737
- | -------- | ---------------------------- | ---------------- |
738
- | `bda` | `border-radius` | - |
739
- | `bdra` | `border-radius` | - |
740
- | `bdtlr` | `border-top-left-radius` | - |
741
- | `bdtrr` | `border-top-right-radius` | - |
742
- | `bdblr` | `border-bottom-left-radius` | - |
743
- | `bdbrr` | `border-bottom-right-radius` | - |
744
- | `bdeer` | `border-end-end-radius` | - |
745
- | `bdesr` | `border-end-start-radius` | - |
746
- | `bdser` | `border-start-end-radius` | - |
747
- | `bdssr` | `border-start-start-radius` | - |
748
-
749
- ### Border Block/Inline
750
-
751
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
752
- | -------- | --------------------- | ---------------------------------------------------------------------------------- |
753
- | `bdblk` | `border-block` | - |
754
- | `bdblc` | `border-block-color` | - |
755
- | `bdble` | `border-block-end` | - |
756
- | `bdbls` | `border-block-start` | - |
757
- | `bdblst` | `border-block-style` | `d:dotted`, `ds:dashed`, `db:double`, `g:groove`, `r:ridge`, `i:inset`, `o:outset` |
758
- | `bdblwi` | `border-block-width` | - |
759
- | `bdi` | `border-inline` | - |
760
- | `bdic` | `border-inline-color` | - |
761
- | `bdie` | `border-inline-end` | - |
762
- | `bdista` | `border-inline-start` | - |
763
- | `bdistl` | `border-inline-style` | - |
764
- | `bdinw` | `border-inline-width` | - |
765
-
766
- ---
767
-
768
- ## 5. Typography
769
-
770
- ### Font
771
-
772
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
773
- | -------- | --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
774
- | `fn` | `font` | - |
775
- | `ff` | `font-family` | `a:ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'`, `s:ui-serif, Georgia, Cambria, 'Times New Roman', Times, serif`, `m:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace` |
776
- | `fnf` | `font-family` | - |
777
- | `fns` | `font-size` | - |
778
- | `fw` | `font-weight` | - |
779
- | `fnw` | `font-weight` | - |
780
- | `fnsty` | `font-style` | - |
781
- | `fnstr` | `font-stretch` | - |
782
- | `fnfs` | `font-feature-settings` | - |
783
- | `fnk` | `font-kerning` | - |
784
- | `fnlo` | `font-language-override` | - |
785
- | `fnos` | `font-optical-sizing` | - |
786
- | `fnp` | `font-palette` | - |
787
- | `fnsa` | `font-size-adjust` | - |
788
- | `fnsyn` | `font-synthesis` | - |
789
- | `fnsp` | `font-synthesis-position` | - |
790
- | `fnssc` | `font-synthesis-small-caps` | - |
791
- | `fnss` | `font-synthesis-style` | - |
792
- | `fnsw` | `font-synthesis-weight` | - |
793
- | `fnv` | `font-variant` | - |
794
- | `fnva` | `font-variant-alternates` | - |
795
- | `fnvc` | `font-variant-caps` | - |
796
- | `fnvea` | `font-variant-east-asian` | - |
797
- | `fnve` | `font-variant-emoji` | - |
798
- | `fnvl` | `font-variant-ligatures` | - |
799
- | `fnvn` | `font-variant-numeric` | - |
800
- | `fnvp` | `font-variant-position` | - |
801
- | `fnvs` | `font-variation-settings` | - |
802
-
803
- ### Text
804
-
805
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
806
- | -------- | --------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
807
- | `ta` | `text-align` | `s:start`, `e:end`, `l:left`, `r:right`, `c:center`, `j:justify`, `mp:match-parent`, `mc:-moz-center`, `wc:-webkit-center` |
808
- | `tal` | `text-align-last` | `s:start`, `e:end`, `l:left`, `r:right`, `c:center`, `j:justify` |
809
- | `td` | `text-decoration` | `u:underline` |
810
- | `tdc` | `text-decoration-color` | - |
811
- | `tdl` | `text-decoration-line` | `u:underline`, `o:overline`, `lt:line-through`, `b:blink` |
812
- | `tds` | `text-decoration-style` | `db:double`, `dt:dotted`, `ds:dashed`, `w:wavy` |
813
- | `tdt` | `text-decoration-thickness` | `ff:from-font` |
814
- | `tdsi` | `text-decoration-skip-ink` | - |
815
- | `teph` | `text-emphasis` | - |
816
- | `tec` | `text-emphasis-color` | - |
817
- | `tep` | `text-emphasis-position` | `or:over right`, `ol:over left`, `ur:under right`, `ul:under left`, `lo:left over`, `ru:right under`, `lu:left under` |
818
- | `tes` | `text-emphasis-style` | - |
819
- | `ti` | `text-indent` | - |
820
- | `tj` | `text-justify` | `iw:inter-word`, `ic:inter-character`, `d:distribute` |
821
- | `tor` | `text-orientation` | `m:mixed`, `u:upright`, `sr:sideways-right`, `sl:sideways-left`, `s:sideways`, `ugo:use-glyph-orientation` |
822
- | `tol` | `text-overflow` | `c:clip`, `e:ellipsis` |
823
- | `trd` | `text-rendering` | `op:optimizeSpeed`, `ol:optimizeLegibility`, `g:geometricPrecision` |
824
- | `tsh` | `text-shadow` | - |
825
- | `ttr` | `text-transform` | `c:capitalize`, `u:uppercase`, `l:lowercase`, `fw:full-width`, `fsk:full-size-kana` |
826
- | `tuo` | `text-underline-offset` | - |
827
- | `tup` | `text-underline-position` | `u:under`, `l:left`, `r:right`, `ul:under left`, `ru:right under` |
828
- | `tw` | `text-wrap` | `w:wrap`, `n:nowrap`, `b:balance`, `p:pretty` |
829
-
830
- ### Line & Spacing
831
-
832
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
833
- | -------- | ---------------- | ---------------- |
834
- | `lh` | `line-height` | - |
835
- | `lts` | `letter-spacing` | `n:normal` |
836
- | `wrs` | `word-spacing` | - |
837
- | `lbrk` | `line-break` | - |
838
- | `wrb` | `word-break` | - |
839
- | `wrtm` | `writing-mode` | - |
840
-
841
- ---
842
-
843
- ## 6. Flexbox
844
-
845
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
846
- | -------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
847
- | `fx` | `flex` | `i:0 1 auto`, `a:1 1 auto` |
848
- | `fxb` | `flex-basis` | - |
849
- | `fxd` | `flex-direction` | `r:row`, `rr:row-reverse`, `c:column`, `cr:column-reverse` |
850
- | `fxf` | `flex-flow` | - |
851
- | `fxg` | `flex-grow` | - |
852
- | `fxs` | `flex-shrink` | - |
853
- | `fxw` | `flex-wrap` | `w:wrap`, `wr:wrap-reverse`, `n:nowrap` |
854
- | `jc` | `justify-content` | `c:center`, `s:start`, `e:end`, `fs:flex-start`, `fe:flex-end`, `l:left`, `r:right`, `n:normal`, `sp:space-between`, `sa:space-around`, `se:space-evenly`, `st:stretch`, `sc:safe center`, `uc:unsafe center` |
855
- | `ai` | `align-items` | `n:normal`, `c:center`, `s:start`, `e:end`, `fs:flex-start`, `fe:flex-end`, `ss:self-start`, `se:self-end`, `b:baseline`, `fb:first baseline`, `lb:last baseline`, `sc:safe center`, `uc:unsafe center` |
856
- | `as` | `align-self` | `n:normal`, `c:center`, `s:start`, `e:end`, `ss:self-start`, `se:self-end`, `fs:flex-start`, `fe:flex-end`, `b:baseline`, `fb:first baseline`, `lb:last baseline`, `st:stretch`, `sc:safe center`, `uc:unsafe center` |
857
- | `ac` | `align-content` | `s:start`, `e:end`, `fs:flex-start`, `fe:flex-end`, `n:normal`, `b:baseline`, `fb:first baseline`, `lb:last baseline`, `sp:space-between`, `sa:space-around`, `se:space-evenly`, `st:stretch`, `sc:safe center`, `uc:unsafe center` |
858
-
859
- ---
860
-
861
- ## 7. Grid
862
-
863
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
864
- | -------- | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
865
- | `g` | `grid` | - |
866
- | `ga` | `grid-area` | - |
867
- | `gc` | `grid-column` | `f:1 / -1` |
868
- | `gce` | `grid-column-end` | - |
869
- | `gcs` | `grid-column-start` | - |
870
- | `gr` | `grid-row` | `f:1 / -1` |
871
- | `gre` | `grid-row-end` | - |
872
- | `grs` | `grid-row-start` | - |
873
- | `gt` | `grid-template` | - |
874
- | `gta` | `grid-template-areas` | - |
875
- | `gtc` | `grid-template-columns` | `s:subgrid` |
876
- | `gtr` | `grid-template-rows` | `s:subgrid` |
877
- | `gac` | `grid-auto-columns` | `mic:min-content`, `mac:max-content`, `mm:minmax(0, 1fr)` |
878
- | `gar` | `grid-auto-rows` | `mic:min-content`, `mac:max-content`, `mm:minmax(0, 1fr)` |
879
- | `gaf` | `grid-auto-flow` | `r:row`, `c:column`, `d:dense`, `rd:row dense`, `cd:column dense` |
880
- | `gap` | `gap` | - |
881
- | `rgap` | `row-gap` | - |
882
- | `colg` | `column-gap` | - |
883
- | `ji` | `justify-items` | `n:normal`, `st:stretch`, `c:center`, `s:start`, `e:end`, `fs:flex-start`, `fe:flex-end`, `ss:self-start`, `se:self-end`, `l:left`, `r:right`, `b:baseline`, `fb:first baseline`, `lb:last baseline`, `lr:legacy right`, `ll:legacy left`, `lc:legacy center`, `sc:safe center`, `uc:unsafe center` |
884
- | `js` | `justify-self` | `n:normal`, `st:stretch`, `c:center`, `s:start`, `e:end`, `fs:flex-start`, `fe:flex-end`, `ss:self-start`, `se:self-end`, `l:left`, `r:right`, `b:baseline`, `sc:safe center`, `uc:unsafe center` |
885
- | `pli` | `place-items` | - |
886
- | `pls` | `place-self` | - |
887
- | `plc` | `place-content` | - |
888
-
889
- ---
890
-
891
- ## 8. Effects & Filters
892
-
893
- ### Opacity & Visibility
894
-
895
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
896
- | -------- | ------------ | ---------------- |
897
- | `opc` | `opacity` | - |
898
- | `v` | `visibility` | `c:collapse` |
899
-
900
- ### Filter & Backdrop
901
-
902
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
903
- | -------- | ----------------- | ---------------- |
904
- | `flt` | `filter` | - |
905
- | `bkdf` | `backdrop-filter` | - |
906
-
907
- ### Blend Modes
908
-
909
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
910
- | -------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
911
- | `mbd` | `mix-blend-mode` | `n:normal`, `m:multiply`, `s:screen`, `o:overlay`, `d:darken`, `l:lighten`, `cd:color-dodge`, `i:color-burn`, `hl:hard-light`, `sl:soft-light`, `di:difference`, `e:exclusion`, `h:hue`, `sa:saturation`, `c:color`, `lu:luminosity` |
912
-
913
- ### Box Shadow
914
-
915
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
916
- | -------- | ------------ | ---------------- |
917
- | `bxsh` | `box-shadow` | - |
918
- | `bxshd` | `box-shadow` | - |
919
-
920
- ---
921
-
922
- ## 9. Transforms & Animations
923
-
924
- ### Transform
925
-
926
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
927
- | -------- | ------------------ | ---------------- |
928
- | `tra` | `transform` | - |
929
- | `trab` | `transform-box` | - |
930
- | `trao` | `transform-origin` | - |
931
- | `tras` | `transform-style` | - |
932
- | `rot` | `rotate` | - |
933
- | `s` | `scale` | - |
934
- | `trl` | `translate` | - |
935
-
936
- ### Transition
937
-
938
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
939
- | --------- | ---------------------------- | ---------------- |
940
- | `tran` | `transition` | - |
941
- | `tranb` | `transition-behavior` | - |
942
- | `trand` | `transition-delay` | - |
943
- | `trandur` | `transition-duration` | - |
944
- | `tranp` | `transition-property` | - |
945
- | `trantf` | `transition-timing-function` | - |
946
-
947
- ### Animation
948
-
949
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
950
- | -------- | --------------------------- | ---------------------------------------------------------------------------------------------------------------- |
951
- | `ani` | `animation` | - |
952
- | `anic` | `animation-composition` | `r:replace`, `a:add`, `ac:accumulate`, `ra:replace, add`, `aac:add, accumulate`, `raac:replace, add, accumulate` |
953
- | `anide` | `animation-delay` | - |
954
- | `anidi` | `animation-direction` | `r:reverse`, `a:alternate`, `ar:alternate-reverse`, `nr:normal, reverse`, `arn:alternate, reverse, normal` |
955
- | `anidu` | `animation-duration` | - |
956
- | `anifm` | `animation-fill-mode` | `f:forwards`, `b:backwards`, `nb:none, backwards`, `fbn:both, forwards, none` |
957
- | `aniic` | `animation-iteration-count` | - |
958
- | `anin` | `animation-name` | `s:slide` |
959
- | `anips` | `animation-play-state` | `p:paused`, `r:running` |
960
- | `anitf` | `animation-timing-function` | `ei:ease-in`, `eo:ease-out`, `eio:ease-in-out`, `l:linear`, `ss:step-start`, `se:step-end` |
961
-
962
- ---
963
-
964
- ## 10. Overflow & Scrolling
965
-
966
- ### Overflow
967
-
968
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
969
- | -------- | ---------------------- | -------------------- |
970
- | `ofl` | `overflow` | - |
971
- | `oflx` | `overflow-x` | `c:clip`, `s:scroll` |
972
- | `ofly` | `overflow-y` | `c:clip`, `s:scroll` |
973
- | `oflb` | `overflow-block` | - |
974
- | `ofli` | `overflow-inline` | - |
975
- | `ofla` | `overflow-anchor` | - |
976
- | `oflcm` | `overflow-clip-margin` | - |
977
- | `oflw` | `overflow-wrap` | `c:clip`, `s:scroll` |
978
-
979
- ### Scroll
980
-
981
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
982
- | -------- | ----------------------- | ---------------- |
983
- | `scrb` | `scroll-behavior` | - |
984
- | `scrm` | `scroll-margin` | - |
985
- | `scrmb` | `scroll-margin-bottom` | - |
986
- | `scrml` | `scroll-margin-left` | - |
987
- | `scrmr` | `scroll-margin-right` | - |
988
- | `scrmt` | `scroll-margin-top` | - |
989
- | `scrp` | `scroll-padding` | - |
990
- | `scrpb` | `scroll-padding-bottom` | - |
991
- | `scrpl` | `scroll-padding-left` | - |
992
- | `scrpr` | `scroll-padding-right` | - |
993
- | `scrpt` | `scroll-padding-top` | - |
994
- | `scrsa` | `scroll-snap-align` | - |
995
- | `scrss` | `scroll-snap-stop` | - |
996
- | `scrst` | `scroll-snap-type` | - |
997
- | `sbc` | `scrollbar-color` | - |
998
- | `sbg` | `scrollbar-gutter` | - |
999
- | `sbw` | `scrollbar-width` | - |
1000
-
1001
- ### Overscroll
1002
-
1003
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
1004
- | -------- | ---------------------------- | ---------------- |
1005
- | `osrbh` | `overscroll-behavior` | `c:contain` |
1006
- | `osrbb` | `overscroll-behavior-block` | `c:contain` |
1007
- | `osrbi` | `overscroll-behavior-inline` | `c:contain` |
1008
- | `osrbx` | `overscroll-behavior-x` | `c:contain` |
1009
- | `orsby` | `overscroll-behavior-y` | `c:contain` |
1010
-
1011
- ---
1012
-
1013
- ## 11. Lists & Tables
1014
-
1015
- ### Lists
1016
-
1017
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
1018
- | -------- | --------------------- | ------------------------------------------------------------------------------------------------------------------- |
1019
- | `ls` | `list-style` | `i:inside`, `di:disc`, `c:circle`, `s:square`, `de:decimal`, `g:georgian`, `tci:trad-chinese-informal`, `k:kannada` |
1020
- | `lsi` | `list-style-image` | - |
1021
- | `lisp` | `list-style-position` | `i:inside`, `o:outside` |
1022
- | `lst` | `list-style-type` | `di:disc`, `c:circle`, `s:square`, `de:decimal`, `g:georgian`, `tci:trad-chinese-informal`, `k:kannada` |
1023
-
1024
- ### Tables
1025
-
1026
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
1027
- | -------- | ----------------- | -------------------------- |
1028
- | `tbl` | `table-layout` | - |
1029
- | `bdcl` | `border-collapse` | `s:separate`, `c:collapse` |
1030
- | `bdsp` | `border-spacing` | - |
1031
- | `empc` | `empty-cells` | - |
1032
- | `caps` | `caption-side` | - |
1033
-
1034
- ### Columns
1035
-
1036
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
1037
- | -------- | ------------------- | ---------------- |
1038
- | `col` | `columns` | - |
1039
- | `colc` | `column-count` | - |
1040
- | `colf` | `column-fill` | - |
1041
- | `colg` | `column-gap` | - |
1042
- | `colr` | `column-rule` | - |
1043
- | `colrc` | `column-rule-color` | - |
1044
- | `colrs` | `column-rule-style` | - |
1045
- | `colrw` | `column-rule-width` | - |
1046
- | `cols` | `column-span` | - |
1047
- | `colw` | `column-width` | - |
1048
-
1049
- ---
1050
-
1051
- ## 12. Advanced Properties
1052
-
1053
- ### Containment
1054
-
1055
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
1056
- | -------- | ------------------------------- | ---------------- |
1057
- | `cnt` | `contain` | - |
1058
- | `cntibs` | `contain-intrinsic-block-size` | - |
1059
- | `cntih` | `contain-intrinsic-height` | - |
1060
- | `cntiis` | `contain-intrinsic-inline-size` | - |
1061
- | `cntis` | `contain-intrinsic-size` | - |
1062
- | `ciw` | `contain-intrinsic-width` | - |
1063
-
1064
- ### Container Queries
1065
-
1066
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
1067
- | -------- | ---------------- | ---------------- |
1068
- | `ctr` | `container` | - |
1069
- | `ctrn` | `container-name` | - |
1070
- | `ctrt` | `container-type` | - |
1071
-
1072
- ### Content & Counters
1073
-
1074
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
1075
- | -------- | ------------------- | ---------------- |
1076
- | `ctt` | `content` | - |
1077
- | `cntri` | `counter-increment` | - |
1078
- | `cntrr` | `counter-reset` | - |
1079
- | `cntrs` | `counter-set` | - |
1080
-
1081
- ### Page Breaks
1082
-
1083
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
1084
- | -------- | ------------------- | ---------------- |
1085
- | `pg` | `page` | - |
1086
- | `pgba` | `page-break-after` | - |
1087
- | `pgbb` | `page-break-before` | - |
1088
- | `pgbi` | `page-break-inside` | - |
1089
- | `brka` | `break-after` | - |
1090
- | `brkb` | `break-before` | - |
1091
- | `brki` | `break-inside` | - |
1092
-
1093
- ### Other Advanced
1094
-
1095
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
1096
- | -------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1097
- | `a` | `all` | - |
1098
- | `is` | `isolation` | `i:isolate` |
1099
- | `z` | `z-index` | - |
1100
- | `ord` | `order` | - |
1101
- | `fl` | `float` | `is:inline-start`, `ie:inline-end`, `r:right`, `l:left` |
1102
- | `clr` | `clear` | - |
1103
- | `rsz` | `resize` | `b:both`, `h:horizontal`, `v:vertical` |
1104
- | `us` | `user-select` | `t:text`, `all:all`, `c:contain` |
1105
- | `pe` | `pointer-events` | - |
1106
- | `cr` | `cursor` | `p:pointer`, `d:default`, `cm:context-menu`, `h:help`, `pg:progress`, `w:wait`, `c:cell`, `t:text`, `vt:vertical-text`, `al:alias`, `cp:copy`, `mo:move`, `nd:no-drop`, `na:not-allowed`, `gr:grab`, `gb:grabbing`, `as:all-scroll`, `colr:col-resize`, `rr:row-resize`, `nr:n-resize`, `er:e-resize`, `sr:s-resize`, `wr:w-resize`, `ner:ne-resize`, `ser:se-resize`, `swr:sw-resize`, `ewr:ew-resize`, `nsr:ns-resize`, `nesw:nesw-resize`, `nwse:nwse-resize`, `zi:zoom-in`, `zo:zoom-out` |
1107
- | `toa` | `touch-action` | `p:pan-x`, `py:pan-y`, `pm:pan-x pan-y`, `pi:pinch-zoom` |
1108
- | `zo` | `zoom` | - |
1109
-
1110
- ---
1111
-
1112
- ## 13. WebKit Specific
1113
-
1114
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
1115
- | -------- | --------------------------- | --------------------- |
1116
- | `wlc` | `-webkit-line-clamp` | - |
1117
- | `wtfc` | `-webkit-text-fill-color` | - |
1118
- | `wts` | `-webkit-text-stroke` | - |
1119
- | `wtsc` | `-webkit-text-stroke-color` | - |
1120
- | `wtsw` | `-webkit-text-stroke-width` | `m:medium`, `t:thick` |
1121
-
1122
- ---
1123
-
1124
- ## 14. Special Values
1125
-
1126
- ### Common Values
1127
-
1128
- - `n` = `none`
1129
- - `nm` = `normal`
1130
- - `a` = `auto`
1131
- - `i` = `inherit`
1132
- - `in` = `initial`
1133
- - `is` = `inline-start`
1134
- - `ie` = `inline-end`
1135
- - `tr` = `transparent`
1136
- - `c` = `center`
1137
- - `cl` = `collapse`
1138
- - `l` = `left`
1139
- - `r` = `right`
1140
- - `h` = `hidden`
1141
- - `v` = `visible`
1142
- - `s` = `start`
1143
- - `e` = `end`
1144
- - `t` = `top`
1145
- - `b` = `bottom`
1146
- - `bs` = `block-start`
1147
- - `be` = `block-end`
1148
-
1149
- ### Size Values
1150
-
1151
- - `t` = `thin`
1152
- - `m` = `medium`
1153
- - `th` = `thick`
1154
-
1155
- ### Style Values
1156
-
1157
- - `s` = `solid`
1158
- - `d` = `dotted`
1159
- - `ds` = `dashed`
1160
- - `db` = `double`
1161
- - `g` = `groove`
1162
- - `r` = `ridge`
1163
- - `i` = `inset`
1164
- - `o` = `outset`
1165
-
1166
- ---
1167
-
1168
- _Bảng tra cứu này bao gồm tất cả 409 thuộc tính CSS và giá trị viết tắt được hỗ trợ trong xCSS. Để sử dụng, hãy kết hợp viết tắt thuộc tính với giá trị viết tắt theo cú pháp: `[MQ:][layer]<property><value>[@selector]` (lưu ý: `<property><value>` là bắt buộc)_
1169
-
1170
- # Hướng dẫn sử dụng xCSS
1171
-
1172
- xCSS là một hệ thống CSS-in-JS cho phép bạn viết CSS ngắn gọn và hiệu quả thông qua các class name đặc biệt. Sau khi học, bạn sẽ:
1173
-
1174
- - Đọc/viết class theo công thức và hiểu nó biến thành CSS như thế nào
1175
- - Kiểm soát **media query**, **@layer**, **!important**, **selector** giả (pseudo) và tổ hợp nhiều thuộc tính trong **một class**
1176
-
1177
- > **Lưu ý**: Danh sách viết tắt thuộc tính và giá trị sẽ có ở **phần sau**.
1178
-
1179
- ## Cú pháp tổng quát
1180
-
1181
- ```
1182
- [MQ:][layer]<property><value>[@selector]
1183
- ```
1184
-
1185
- **Lưu ý quan trọng**: `<property><value>` là **bắt buộc** - phải có cả thuộc tính CSS và giá trị CSS.
1186
-
1187
- **Ví dụ cú pháp đúng:**
1188
-
1189
- - `cRed` - Màu đỏ (layer 0)
1190
- - `5cRed` - Màu đỏ ở layer 5
1191
- - `md:cRed` - Màu đỏ trên màn hình trung bình
1192
- - `md:5cRed` - Màu đỏ ở layer 5 trên màn hình trung bình
1193
-
1194
- ### Các thành phần:
1195
-
1196
- #### 1. Media Query (MQ) - Tùy chọn
1197
-
1198
- - `xs:` - Màn hình nhỏ (max-width: 575px)
1199
- - `sm:` - Màn hình nhỏ (min-width: 576px)
1200
- - `md:` - Màn hình trung bình (min-width: 768px)
1201
- - `lg:` - Màn hình lớn (min-width: 992px)
1202
- - `xl:` - Màn hình rất lớn (min-width: 1200px)
1203
- - `2xl:` - Màn hình cực lớn (min-width: 1400px)
1204
- - `sma:` - Màn hình nhỏ trở xuống (max-width: 768px)
1205
- - `mda:` - Màn hình trung bình trở xuống (max-width: 992px)
1206
- - `lga:` - Màn hình lớn trở xuống (max-width: 1200px)
1207
- - `xla:` - Màn hình rất lớn trở xuống (max-width: 1400px)
1208
-
1209
- #### 2. Layer - Tùy chọn
1210
-
1211
- - `1` đến `19` - Thứ tự ưu tiên CSS layer (số càng cao ưu tiên càng cao)
1212
- - Mặc định: `0` (layer 0)
1213
- - Mục đích: gom nhóm quy tắc theo tầng (base, component, utilities, overrides…)
1214
-
1215
- #### 3. Property (Thuộc tính) - **BẮT BUỘC**
1216
-
1217
- - Viết thường, có thể là tên đầy đủ hoặc viết tắt
1218
- - Không có dấu `-` trừ trường hợp có thuộc tính có dấu trừ thường bắt đầu `-w`
1219
- - Ví dụ: `w` (width), `h` (height), `c` (color), `bg` (background)
1220
-
1221
- #### 4. Value (Giá trị) - **BẮT BUỘC**
1222
-
1223
- - **Số**: `10`, `-4.5`, `0.5`, có thể kèm **đơn vị**: `10px`, `1.5rem`, `100%`
1224
- - **Giá trị đặt tên** bắt đầu bằng **chữ hoa**: `Red`, `Center`, `Block`, `Fixed`, `None`
1225
- - **Giá trị trong ngoặc nhọn** để ghi **nguyên văn**: `c{rgb(255,0,0)}`, `bg{linear-gradient(...)}`
1226
- - **Biến CSS**: bắt đầu bằng `--`: `c--primary` → `color: var(--primary)`
1227
- - **Quan trọng**: thêm `!` ngay trước giá trị để ra `!important`: `w!10px` → `width: 10px !important`
1228
- - **Hàm**: dùng dạng **TitleCase** + `(...)` và dùng dấu `;` thay cho khoảng trắng:
1229
- - `wCalc(100%;-;20px)` → `width: calc(100% - 20px)`
1230
- - `tTranslate(50%;,;-50%)` → `transform: translate(50% , -50%)`
1231
-
1232
- #### 5. Selector - Tùy chọn
1233
-
1234
- - Bắt đầu bằng `@`
1235
- - Dấu `;` thay thế cho dấu cách
1236
- - Có thể dùng giả lớp/giả phần tử, chọn phần tử con, hoặc kết hợp
1237
- - Ví dụ: `@:hover`, `@:focus`, `@:active`, `@>a`, `@.btn;:hover`
1238
-
1239
- ## Ví dụ sử dụng
1240
-
1241
- ### Cơ bản
1242
-
1243
- ```html
1244
- <!-- Màu đỏ -->
1245
- <div class="cRed">Văn bản màu đỏ</div>
1246
-
1247
- <!-- Chiều rộng 100px -->
1248
- <div class="w100px">Chiều rộng 100px</div>
1249
-
1250
- <!-- Padding 20px -->
1251
- <div class="p20px">Padding 20px</div>
1252
-
1253
- <!-- Opacity 50% -->
1254
- <div class="opc50%">Độ trong suốt 50%</div>
1255
-
1256
- <!-- Font size 14px -->
1257
- <div class="fns14px">Cỡ chữ 14px</div>
1258
- ```
1259
-
1260
- ### Với Media Query
1261
-
1262
- ```html
1263
- <!-- Màu đỏ trên màn hình lớn -->
1264
- <div class="lg:cRed">Màu đỏ trên desktop</div>
1265
-
1266
- <!-- Ẩn trên màn hình nhỏ -->
1267
- <div class="xs:vHidden">Ẩn trên mobile</div>
1268
-
1269
- <!-- Responsive width -->
1270
- <div class="w100% md:w50% lg:w33%">Responsive width</div>
6
+ ```bash
7
+ npm i @fwkui/x-css
1271
8
  ```
1272
9
 
1273
- ### Với Layer
1274
-
1275
- ```html
1276
- <!-- Layer ưu tiên cao -->
1277
- <div class="5cRed">Màu đỏ ưu tiên cao</div>
1278
-
1279
- <!-- Layer ưu tiên thấp -->
1280
- <div class="1cBlue">Màu xanh ưu tiên thấp</div>
1281
-
1282
- <!-- Kết hợp layer và media query -->
1283
- <div class="md:7cGreen">Màu xanh layer 7 trên desktop</div>
1284
- ```
1285
-
1286
- ### Với Selector
1287
-
1288
- ```html
1289
- <!-- Hover effect -->
1290
- <div class="cRed@:hover">Đỏ khi hover</div>
1291
-
1292
- <!-- Focus effect -->
1293
- <input class="bdw2px@:focus" placeholder="Border khi focus" />
1294
-
1295
- <!-- Child selector -->
1296
- <div class="cBlue@>a">Màu xanh cho thẻ con a</div>
1297
-
1298
- <!-- Complex selector -->
1299
- <div class="cRed@.btn;:hover">Màu đỏ khi hover button</div>
1300
- ```
1301
-
1302
- ### Với giá trị đặc biệt
1303
-
1304
- ```html
1305
- <!-- !important -->
1306
- <div class="c!red">Màu đỏ !important</div>
1307
-
1308
- <!-- CSS Variable -->
1309
- <div class="c--primary">Màu từ CSS variable</div>
1310
-
1311
- <!-- Giá trị tùy chỉnh -->
1312
- <div class="w{calc(100%;-;20px)}">Chiều rộng tính toán</div>
1313
-
1314
- <!-- Hàm CSS -->
1315
- <div class="wClamp(280px;640px;100%)">Width với clamp</div>
1316
-
1317
- <!-- Box shadow phức tạp -->
1318
- <div class="bxsh{0;2px;8px;rgba(0,0,0,.1)}">Shadow phức tạp</div>
1319
- ```
1320
-
1321
- ### Kết hợp nhiều thuộc tính với `&`
1322
-
1323
- ```html
1324
- <!-- Nhiều thuộc tính cùng lúc -->
1325
- <div class="cRed&fw700&taC">Màu đỏ, font-weight 700, căn giữa</div>
1326
-
1327
- <!-- Flexbox layout -->
1328
- <div class="dF&aiC&jcSp">Flexbox center và space-between</div>
1329
-
1330
- <!-- Padding và margin -->
1331
- <div class="p8px&m0">Padding 8px và margin 0</div>
1332
-
1333
- <!-- Kết hợp với selector -->
1334
- <div class="cRed&fw700@:hover">Màu đỏ và font-weight 700 khi hover</div>
1335
- ```
1336
-
1337
- ## Quy tắc ưu tiên & va chạm
1338
-
1339
- 1. **@layer**: lớp số lớn thắng lớp số nhỏ (khi cùng nguồn gốc/specificity)
1340
- 2. **Specificity** của selector: selector cụ thể hơn thắng
1341
- 3. **Thứ tự xuất hiện** trong cùng layer và cùng specificity
1342
- 4. **!important** luôn thắng các quy tắc thường trong cùng phạm vi cascade
1343
-
1344
- Ví dụ: `5cBlue` vs `9cRed` → `9cRed` thắng. Nhưng `5cBlue!` (viết `c!Blue` hoặc `c!{blue}`) có thể tiếp tục thắng nếu cùng layer/scope.
1345
-
1346
- ## Quy tắc quan trọng
1347
-
1348
- ### ✅ Hợp lệ
1349
-
1350
- - `cRed` - Màu đỏ (property: `c`, value: `Red`)
1351
- - `w10px` - Chiều rộng 10px (property: `w`, value: `10px`)
1352
- - `md:cRed` - Màu đỏ trên màn hình trung bình (MQ: `md`, property: `c`, value: `Red`)
1353
- - `2w100px` - Chiều rộng 100px ở layer 2 (layer: `2`, property: `w`, value: `100px`)
1354
- - `cRed@:hover` - Màu đỏ khi hover (property: `c`, value: `Red`, selector: `@:hover`)
1355
- - `w!100px` - Chiều rộng 100px !important (property: `w`, value: `!100px`)
1356
- - `c{red}` - Màu đỏ với giá trị tùy chỉnh (property: `c`, value: `{red}`)
1357
- - `cRed&w700` - Kết hợp nhiều thuộc tính (property: `c`, value: `Red`, property: `w`, value: `700`)
1358
- - `wCalc(100%;-;20px)` - Hàm CSS với dấu `;` (property: `w`, value: `Calc(100%;-;20px)`)
1359
-
1360
- ### ❌ Không hợp lệ
1361
-
1362
- - `Cred` - Chữ C viết hoa ở thuộc tính (property phải viết thường)
1363
- - `C{red}` - Chữ C viết hoa ở thuộc tính (property phải viết thường)
1364
- - `cRed}` - Thiếu dấu mở ngoặc (syntax lỗi)
1365
- - `c-red` - Dấu gạch ngang không được phép (property không được có dấu `-`)
1366
- - `W-10px` - Chữ W viết hoa và dấu gạch ngang (property phải viết thường)
1367
- - `w-!10px` - Dấu gạch ngang không được phép (property không được có dấu `-`)
1368
- - `cRed @:hover` - Có dấu cách trong class name (không được có dấu cách)
1369
- - `c` - Thiếu value (bắt buộc phải có cả property và value)
1370
- - `Red` - Thiếu property (bắt buộc phải có cả property và value)
1371
-
1372
- ## Lỗi phổ biến & cách tránh
1373
-
1374
- - **Dùng chữ hoa ở đầu thuộc tính** → sai. Thuộc tính (**property**) phải là **chữ thường** hoặc `--var`
1375
- - **Thiếu property hoặc value** → sai. Cả hai đều **bắt buộc** phải có
1376
- - **Nhầm dấu `-` và `!`**: `w-!10px` là lỗi. Hãy dùng `w!10px`
1377
- - **Quên `;` trong giá trị có khoảng trắng**: `ff{Courier New}` → nên viết `ff{Courier;New}`
1378
- - **Selector có khoảng trắng** phải dùng `;` và sẽ được đổi lại khi xuất
1379
- - **Không có bảng viết tắt** → trình biên dịch không biết dịch `ta` thành `text-align`
1380
-
1381
- ## Lưu ý
1382
-
1383
- 1. **Property và Value bắt buộc** - Mỗi class phải có cả thuộc tính và giá trị CSS
1384
- 2. **Tên class phải viết thường** - Chỉ property viết thường, value có thể có ký tự HOA
1385
- 3. **Không dùng dấu cách** - Dùng dấu `;` thay thế
1386
- 4. **CSS.supports validation** - Tất cả class phải được CSS hỗ trợ
1387
- 5. **Thứ tự ưu tiên** - Layer số cao hơn sẽ có ưu tiên cao hơn
1388
- 6. **Media Query** - Chỉ áp dụng trong khoảng màn hình tương ứng
1389
- 7. **Khoảng trắng trong giá trị** dùng dấu `;`. Ví dụ: `ff{Courier;New;monospace}` → `font-family: Courier New, monospace`
1390
-
1391
- ## Lời khuyên từ kinh nghiệm thực tế
1392
-
1393
- ### 🎯 **Nguyên tắc đặt tên class**
1394
-
1395
- #### ✅ **Nên làm:**
1396
-
1397
- - **Ngắn gọn, dễ đọc**: `cRed`, `w100px`, `p16px`
1398
- - **Sử dụng viết tắt chuẩn**: `dF` thay vì `displayFlex` (d: display, F: Flex)
1399
-
1400
- #### ❌ **Tránh:**
1401
-
1402
- - **Tên quá dài**: `wCalc(100%;-;20px;-;30px;-;10px)` → nên dùng CSS variable
1403
- - **Giá trị phức tạp**: `bxsh{0;4px;8px;12px;rgba(0,0,0,0.1);inset}` → nên định nghĩa qua biến
1404
- - **Thuộc tính lặp lại**: `cRed`, `cBlue`, `cGreen` → nên dùng color palette
1405
-
1406
- ### 🎨 **Quản lý giá trị phức tạp**
1407
-
1408
- #### **Sử dụng CSS Variables cho giá trị dài:**
1409
-
1410
- ```css
1411
- :root {
1412
- --shadow-card: 0 4px 8px rgba(0, 0, 0, 0.1);
1413
- --shadow-hover: 0 8px 16px rgba(0, 0, 0, 0.15);
1414
- --border-radius: 8px;
1415
- --spacing-sm: 8px;
1416
- --spacing-md: 16px;
1417
- --spacing-lg: 24px;
1418
- }
1419
- ```
1420
-
1421
- ```html
1422
- <!-- Thay vì viết dài -->
1423
- <div class="bxsh{0;4px;8px;rgba(0,0,0,0.1)} bdra8px p16px">
1424
- <!-- Nên dùng biến -->
1425
- <div class="bxsh--shadow-card bdra--border-radius p--spacing-md"></div>
1426
- </div>
1427
- ```
1428
-
1429
- #### **Tạo component classes cho pattern thường dùng:**
1430
-
1431
- ```html
1432
- <!-- Thay vì lặp lại nhiều lần -->
1433
- <div class="dF&aiC&jcSp&p16px&bgcWhite&bxsh{0;2px;4px;rgba(0,0,0,0.1)}">
1434
- <!-- Nên tạo component class -->
1435
- <div class="card"></div>
1436
- </div>
1437
- ```
1438
-
1439
- ### 📱 **Responsive Design Best Practices**
1440
-
1441
- #### **Sử dụng mobile-first approach:**
1442
-
1443
- ```html
1444
- <!-- Base styles cho mobile -->
1445
- <div class="w100% p8px">
1446
- <!-- Override cho desktop -->
1447
- <div class="md:w50% md:p16px lg:w33% lg:p24px"></div>
1448
- </div>
1449
- ```
1450
-
1451
- #### **Nhóm breakpoints logic:**
1452
-
10
+ ## Sử dụng nhanh (vanilla/HTML)
1453
11
  ```html
1454
- <!-- Layout chính -->
1455
- <div class="dB md:dF">
1456
- <!-- Spacing responsive -->
1457
- <div class="p8px md:p16px lg:p24px">
1458
- <!-- Typography responsive -->
1459
- <div class="fns14px md:fns16px lg:fns18px"></div>
1460
- </div>
1461
- </div>
1462
- ```
1463
-
1464
- ### 🎭 **Layer Management**
1465
-
1466
- #### **Tổ chức layers theo hierarchy:**
1467
-
1468
- ```html
1469
- <!-- Base styles (0) -->
1470
- <div class="cBlack fns16px">
1471
- <!-- Component styles (1-5) -->
1472
- <div class="2btnPrimary">
1473
- <!-- Utility styles (6-10) -->
1474
- <div class="8m16px">
1475
- <!-- Override styles (11-19) -->
1476
- <div class="15cRed"></div>
1477
- </div>
1478
- </div>
1479
- </div>
1480
- ```
1481
-
1482
- ### 🔧 **Performance Tips**
1483
-
1484
- #### **Tránh over-engineering:**
1485
-
1486
- ```html
1487
- <!-- Đơn giản và hiệu quả -->
1488
- <div class="dF&aiC&p16px">
1489
- <!-- Thay vì phức tạp không cần thiết -->
1490
- <div class="dF&aiC&jcC&p16px&m0&b0&bgcT"></div>
1491
- </div>
1492
- ```
1493
-
1494
- #### **Sử dụng shorthand khi có thể:**
1495
-
1496
- ```html
1497
- <!-- Margin shorthand -->
1498
- <div class="m16px">
1499
- <!-- margin: 16px -->
1500
- <div class="mt8px&mb8px">
1501
- <!-- margin-top: 8px; margin-bottom: 8px -->
1502
-
1503
- <!-- Padding shorthand -->
1504
- <div class="p16px">
1505
- <!-- padding: 16px -->
1506
- <div class="px16px&py8px"><!-- padding: 8px 16px --></div>
1507
- </div>
1508
- </div>
1509
- </div>
1510
- ```
1511
-
1512
- ### 🎨 **Design System Integration**
1513
-
1514
- #### **Tạo design tokens:**
1515
-
1516
- ```css
1517
- :root {
1518
- /* Colors */
1519
- --color-primary: #0070f3;
1520
- --color-secondary: #7928ca;
1521
- --color-success: #0070f3;
1522
- --color-warning: #f5a623;
1523
- --color-error: #e00;
1524
-
1525
- /* Spacing scale */
1526
- --space-1: 4px;
1527
- --space-2: 8px;
1528
- --space-3: 12px;
1529
- --space-4: 16px;
1530
- --space-5: 20px;
1531
- --space-6: 24px;
1532
-
1533
- /* Typography scale */
1534
- --text-xs: 12px;
1535
- --text-sm: 14px;
1536
- --text-base: 16px;
1537
- --text-lg: 18px;
1538
- --text-xl: 20px;
1539
- }
1540
- ```
12
+ <!doctype html>
13
+ <html>
14
+ <body>
15
+ <div id="card" class="bgc#fff p10">Card</div>
1541
16
 
1542
- #### **Sử dụng semantic naming:**
17
+ <script type="module">
18
+ import { cssObserve, cssClsx } from "./src/index.js";
1543
19
 
1544
- ```html
1545
- <!-- Thay màu cụ thể -->
1546
- <div class="cBlue">
1547
- <!-- Nên dùng semantic -->
1548
- <div class="cPrimary">
1549
- <div class="cSuccess">
1550
- <div class="cError"></div>
1551
- </div>
1552
- </div>
1553
- </div>
20
+ const clsx = cssClsx(document);
21
+ document.querySelector("#card").className = clsx("bgc#fff", "p10");
22
+ cssObserve(document);
23
+ </script>
24
+ </body>
25
+ </html>
1554
26
  ```
1555
27
 
1556
- ### 🚀 **Maintenance Tips**
28
+ ## Sử dụng voi React
29
+ ```jsx
30
+ import { useEffect, useMemo } from "react";
31
+ import { xcss } from "@fwkui/x-css";
1557
32
 
1558
- #### **Documentation cho team:**
33
+ export default function Card() {
34
+ const engine = useMemo(() => xcss().buildCss(document), []);
1559
35
 
1560
- ```html
1561
- <!-- Component: Button Primary -->
1562
- <!-- Usage: <button class="btnPrimary">Click me</button> -->
1563
- <!-- Variants: btnSecondary, btnDanger, btnGhost -->
1564
- <button class="btnPrimary">Click me</button>
1565
- ```
36
+ useEffect(() => {
37
+ engine?.observe();
38
+ }, [engine]);
1566
39
 
1567
- #### **Consistent naming convention:**
1568
-
1569
- ```html
1570
- <!-- Layout -->
1571
- <div class="container">
1572
- <div class="row">
1573
- <div class="col">
1574
- <!-- Components -->
1575
- <div class="card">
1576
- <div class="btn">
1577
- <div class="input">
1578
- <!-- Utilities -->
1579
- <div class="textCenter">
1580
- <div class="mAuto">
1581
- <div class="dNone"></div>
1582
- </div>
1583
- </div>
1584
- </div>
1585
- </div>
1586
- </div>
40
+ return (
41
+ <div className={engine?.clsx("bgc#fff", "p10") ?? "bgc#fff p10"}>
42
+ Card
1587
43
  </div>
1588
- </div>
1589
- </div>
1590
- ```
1591
-
1592
- ### 💡 **Pro Tips**
1593
-
1594
- 1. **Luôn test trên mobile trước** - Mobile-first approach
1595
- 2. **Sử dụng browser dev tools** - Kiểm tra CSS output
1596
- 3. **Tạo style guide** - Document các pattern thường dùng
1597
- 4. **Code review** - Đảm bảo consistency trong team
1598
- 5. **Performance monitoring** - Theo dõi CSS bundle size
1599
- 6. **Accessibility first** - Luôn nghĩ đến người dùng khuyết tật
1600
-
1601
- ## dụ tổng hợp
1602
-
1603
- **HTML**
1604
-
1605
- ```html
1606
- <div
1607
- class="md:7 dF&aiC&jcSp p16px bgc--panel bxsh{0;2px;8px;rgba(0,0,0,.1)} c--fg@>a;:hover"
1608
- >
1609
- <a class="cBlue wClamp(120px;240px;100%)">Link</a>
1610
- <button class="w!120px h40px bdra8px cWhite bgc#0070f3">Nút</button>
1611
- </div>
1612
- ```
1613
-
1614
- **CSS (phát sinh ý tưởng)**
1615
-
1616
- ```css
1617
- @media (min-width: 768px) {
1618
- @layer l7 {
1619
- .md\:7\.dF\&aiC\&jcSp\:where(*) {
1620
- display: flex;
1621
- align-items: center;
1622
- justify-content: space-between;
1623
- padding: 16px;
1624
- background-color: var(--panel);
1625
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
1626
- }
1627
- .md\:7\.c\-\-fg\@\>a\;\:hover > a:hover {
1628
- color: var(--fg);
1629
- }
1630
- .md\:7\.wClamp\(120px\;240px\;100\%\) {
1631
- width: clamp(120px, 240px, 100%);
1632
- }
1633
- }
1634
- }
1635
- .cBlue {
1636
- color: blue;
1637
- }
1638
- .w\!120px {
1639
- width: 120px !important;
1640
- }
1641
- .h40px {
1642
- height: 40px;
1643
- }
1644
- .bdra8px {
1645
- border-radius: 8px;
1646
- }
1647
- .cWhite {
1648
- color: #fff;
1649
- }
1650
- .bgc\#0070f3 {
1651
- background-color: #0070f3;
1652
- }
1653
- ```
1654
-
1655
- ## Bảng tra cứu nhanh
1656
-
1657
- ### Media Query
1658
-
1659
- | Ký hiệu | Kích thước màn hình |
1660
- | ------- | ------------------- |
1661
- | `xs:` | ≤ 575px |
1662
- | `sm:` | ≥ 576px |
1663
- | `md:` | ≥ 768px |
1664
- | `lg:` | ≥ 992px |
1665
- | `xl:` | ≥ 1200px |
1666
- | `2xl:` | ≥ 1400px |
1667
-
1668
- ### Layer
1669
-
1670
- | Ký hiệu | Mô tả |
1671
- | ------- | ---------------------------------------------- |
1672
- | `0` | Layer mặc định (ưu tiên thấp) |
1673
- | `1-19` | Layer tùy chỉnh (số càng cao ưu tiên càng cao) |
1674
-
1675
- ### Giá trị đặc biệt
1676
-
1677
- | Ký hiệu | Ý nghĩa |
1678
- | ------- | ----------------- |
1679
- | `!` | !important |
1680
- | `--` | CSS Variable |
1681
- | `{}` | Giá trị tùy chỉnh |
1682
- | `;` | Thay thế dấu cách |
1683
-
1684
- ## Câu hỏi thường gặp (FAQ)
1685
-
1686
- **Hỏi:** Tại sao phải viết hoa chữ cái đầu giá trị dạng từ khoá?
1687
-
1688
- **Đáp:** Để phân biệt **p** (thuộc tính viết thường) và **v** (giá trị đặt tên). Tránh nhầm `red` (giá trị) với một thuộc tính giả định.
1689
-
1690
- **Hỏi:** Dùng dấu gì cho khoảng trắng?
1691
-
1692
- **Đáp:** Dùng dấu `;` trong **giá trị** và **selector** để không phá vỡ tên class.
1693
-
1694
- **Hỏi:** Tôi muốn thêm breakpoint mới?
1695
-
1696
- **Đáp:** Bổ sung mã tiền tố (ví dụ `xxl:`) và map sang `@media (min-width: …)` trong cấu hình biên dịch.
1697
-
1698
- **Hỏi:** Có cần escape khi viết trong HTML?
1699
-
1700
- **Đáp:** Không. Bạn viết thô như quy ước. Bộ biên dịch sẽ escape khi phát sinh CSS.
1701
-
1702
- ---
1703
-
1704
- # Bảng tra cứu đầy đủ thuộc tính và giá trị xCSS
1705
-
1706
- ## Cấu trúc dữ liệu
1707
-
1708
- - **Viết tắt**: Ký hiệu ngắn gọn để sử dụng trong class
1709
- - **Thuộc tính CSS**: Tên đầy đủ của thuộc tính CSS
1710
- - **Giá trị viết tắt**: Mapping từ ký hiệu sang giá trị CSS (nếu có)
1711
-
1712
- ---
1713
-
1714
- ## 1. Layout & Display
1715
-
1716
- ### Display
1717
-
1718
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
1719
- | -------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1720
- | `d` | `display` | `b:block`, `ib:inline-block`, `i:inline`, `f:flex`, `if:inline-flex`, `t:table`, `it:inline-table`, `tcp:table-caption`, `tcell:table-cell`, `tcol:table-column`, `tcolg:table-column-group`, `tfg:table-footer-group`, `thg:table-header-group`, `trg:table-row-group`, `tr:table-row`, `fr:flow-root`, `g:grid`, `ig:inline-grid`, `c:contents`, `li:list-item` |
1721
-
1722
- ### Position
1723
-
1724
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
1725
- | -------- | ---------- | -------------------------------------------------------------- |
1726
- | `pos` | `position` | `s:static`, `f:fixed`, `a:absolute`, `r:relative`, `st:sticky` |
1727
-
1728
- ### Sizing
1729
-
1730
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
1731
- | -------- | ----------------- | ---------------------------------------------------------------- |
1732
- | `w` | `width` | `mic:min-content`, `mac:max-content`, `fc:fit-content`, `f:100%` |
1733
- | `h` | `height` | `mic:min-content`, `mac:max-content`, `fc:fit-content` |
1734
- | `mw` | `max-width` | - |
1735
- | `mxw` | `max-width` | - |
1736
- | `mh` | `max-height` | - |
1737
- | `miw` | `min-width` | `f:100%`, `mic:min-content`, `mac:max-content`, `fc:fit-content` |
1738
- | `mih` | `min-height` | `f:100%`, `mic:min-content`, `mac:max-content`, `fc:fit-content` |
1739
- | `blks` | `block-size` | - |
1740
- | `ins` | `inline-size` | - |
1741
- | `mbs` | `max-block-size` | - |
1742
- | `mis` | `max-inline-size` | - |
1743
- | `mibs` | `min-block-size` | - |
1744
- | `misz` | `min-inline-size` | - |
1745
-
1746
- ### Positioning
1747
-
1748
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
1749
- | -------- | -------------------- | ---------------- |
1750
- | `t` | `top` | - |
1751
- | `r` | `right` | - |
1752
- | `b` | `bottom` | - |
1753
- | `l` | `left` | - |
1754
- | `i` | `inset` | - |
1755
- | `iblk` | `inset-block` | - |
1756
- | `ibe` | `inset-block-end` | - |
1757
- | `ibsta` | `inset-block-start` | - |
1758
- | `ii` | `inset-inline` | - |
1759
- | `iie` | `inset-inline-end` | - |
1760
- | `iis` | `inset-inline-start` | - |
1761
-
1762
- ---
1763
-
1764
- ## 2. Spacing
1765
-
1766
- ### Margin
1767
-
1768
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
1769
- | -------- | --------------------- | ---------------- |
1770
- | `m` | `margin` | - |
1771
- | `mt` | `margin-top` | - |
1772
- | `mr` | `margin-right` | - |
1773
- | `mb` | `margin-bottom` | - |
1774
- | `ml` | `margin-left` | - |
1775
- | `mblk` | `margin-block` | - |
1776
- | `mbe` | `margin-block-end` | - |
1777
- | `mbsta` | `margin-block-start` | - |
1778
- | `min` | `margin-inline` | - |
1779
- | `mie` | `margin-inline-end` | - |
1780
- | `mista` | `margin-inline-start` | - |
1781
-
1782
- ### Padding
1783
-
1784
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
1785
- | -------- | ---------------------- | ---------------------------------------------------------- |
1786
- | `p` | `padding` | - |
1787
- | `pt` | `padding-top` | - |
1788
- | `pr` | `padding-right` | - |
1789
- | `pb` | `padding-bottom` | - |
1790
- | `pl` | `padding-left` | - |
1791
- | `pblk` | `padding-block` | - |
1792
- | `pbe` | `padding-block-end` | - |
1793
- | `pbs` | `padding-block-start` | - |
1794
- | `pi` | `padding-inline` | `s:start`, `c:center`, `e:end`, `b:baseline`, `st:stretch` |
1795
- | `pie` | `padding-inline-end` | - |
1796
- | `pis` | `padding-inline-start` | - |
1797
-
1798
- ---
1799
-
1800
- ## 3. Colors & Background
1801
-
1802
- ### Color
1803
-
1804
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
1805
- | -------- | ---------- | ---------------------------- |
1806
- | `c` | `color` | `i:inherit`, `t:transparent` |
1807
-
1808
- ### Background
1809
-
1810
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
1811
- | -------- | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
1812
- | `bg` | `background` | - |
1813
- | `bgc` | `background-color` | `t:transparent`, `c:currentcolor` |
1814
- | `bgi` | `background-image` | - |
1815
- | `bgp` | `background-position` | `t:top`, `b:bottom`, `l:left`, `r:right`, `c:center`, `lt:left top`, `ct:center top`, `rt:right top`, `lc:left center`, `cc:center center`, `rc:right center`, `lb:left bottom`, `cb:center bottom`, `rb:right bottom` |
1816
- | `bgpx` | `background-position-x` | `l:left`, `r:right`, `c:center` |
1817
- | `bgpy` | `background-position-y` | `t:top`, `b:bottom`, `c:center` |
1818
- | `bgr` | `background-repeat` | `r:repeat`, `x:repeat-x`, `y:repeat-y`, `s:space`, `rn:round`, `n:no-repeat`, `rs: repeat space`, `rr:repeat repeat`, `nr:no-repeat round` |
1819
- | `bgs` | `background-size` | `c:contain` |
1820
- | `bga` | `background-attachment` | `s:scroll`, `f:fixed`, `l:local` |
1821
- | `bgbm` | `background-blend-mode` | `n:normal`, `m:multiply`, `s:screen`, `o:overlay`, `d:darken`, `l:lighten`, `cd:color-dodge`, `i:color-burn`, `hl:hard-light`, `sl:soft-light`, `di:difference`, `e:exclusion`, `h:hue`, `sa:saturation`, `c:color`, `lu:luminosity` |
1822
- | `bgcl` | `background-clip` | `bb:border-box`, `pb:padding-box`, `cb:content-box`, `t:text` |
1823
- | `bgo` | `background-origin` | `bb:border-box`, `pb:padding-box`, `cb:content-box` |
1824
-
1825
- ---
1826
-
1827
- ## 4. Border
1828
-
1829
- ### Border General
1830
-
1831
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
1832
- | -------- | -------------- | ------------------------------------------------------------------------------------------------- |
1833
- | `bd` | `border` | `d:dotted`, `ds:dashed`, `db:double`, `g:groove`, `r:ridge`, `i:inset`, `o:outset` |
1834
- | `bds` | `border-style` | `dt:dotted`, `ds:dashed`, `s:solid`, `db:double`, `g:groove`, `r:ridge`, `in:inset`, `out:outset` |
1835
- | `bdc` | `border-color` | - |
1836
- | `bdw` | `border-width` | `t:thin`, `m:medium`, `th:thick` |
1837
-
1838
- ### Border Sides
1839
-
1840
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
1841
- | -------- | --------------- | ---------------- |
1842
- | `bdt` | `border-top` | - |
1843
- | `bdr` | `border-right` | - |
1844
- | `bdb` | `border-bottom` | - |
1845
- | `bdl` | `border-left` | - |
1846
-
1847
- ### Border Radius
1848
-
1849
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
1850
- | -------- | ---------------------------- | ---------------- |
1851
- | `bda` | `border-radius` | - |
1852
- | `bdra` | `border-radius` | - |
1853
- | `bdtlr` | `border-top-left-radius` | - |
1854
- | `bdtrr` | `border-top-right-radius` | - |
1855
- | `bdblr` | `border-bottom-left-radius` | - |
1856
- | `bdbrr` | `border-bottom-right-radius` | - |
1857
- | `bdeer` | `border-end-end-radius` | - |
1858
- | `bdesr` | `border-end-start-radius` | - |
1859
- | `bdser` | `border-start-end-radius` | - |
1860
- | `bdssr` | `border-start-start-radius` | - |
1861
-
1862
- ### Border Block/Inline
1863
-
1864
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
1865
- | -------- | --------------------- | ---------------------------------------------------------------------------------- |
1866
- | `bdblk` | `border-block` | - |
1867
- | `bdblc` | `border-block-color` | - |
1868
- | `bdble` | `border-block-end` | - |
1869
- | `bdbls` | `border-block-start` | - |
1870
- | `bdblst` | `border-block-style` | `d:dotted`, `ds:dashed`, `db:double`, `g:groove`, `r:ridge`, `i:inset`, `o:outset` |
1871
- | `bdblwi` | `border-block-width` | - |
1872
- | `bdi` | `border-inline` | - |
1873
- | `bdic` | `border-inline-color` | - |
1874
- | `bdie` | `border-inline-end` | - |
1875
- | `bdista` | `border-inline-start` | - |
1876
- | `bdistl` | `border-inline-style` | - |
1877
- | `bdinw` | `border-inline-width` | - |
1878
-
1879
- ---
1880
-
1881
- ## 5. Typography
1882
-
1883
- ### Font
1884
-
1885
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
1886
- | -------- | --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1887
- | `fn` | `font` | - |
1888
- | `ff` | `font-family` | `a:ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'`, `s:ui-serif, Georgia, Cambria, 'Times New Roman', Times, serif`, `m:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace` |
1889
- | `fnf` | `font-family` | - |
1890
- | `fns` | `font-size` | - |
1891
- | `fw` | `font-weight` | - |
1892
- | `fnw` | `font-weight` | - |
1893
- | `fnsty` | `font-style` | - |
1894
- | `fnstr` | `font-stretch` | - |
1895
- | `fnfs` | `font-feature-settings` | - |
1896
- | `fnk` | `font-kerning` | - |
1897
- | `fnlo` | `font-language-override` | - |
1898
- | `fnos` | `font-optical-sizing` | - |
1899
- | `fnp` | `font-palette` | - |
1900
- | `fnsa` | `font-size-adjust` | - |
1901
- | `fnsyn` | `font-synthesis` | - |
1902
- | `fnsp` | `font-synthesis-position` | - |
1903
- | `fnssc` | `font-synthesis-small-caps` | - |
1904
- | `fnss` | `font-synthesis-style` | - |
1905
- | `fnsw` | `font-synthesis-weight` | - |
1906
- | `fnv` | `font-variant` | - |
1907
- | `fnva` | `font-variant-alternates` | - |
1908
- | `fnvc` | `font-variant-caps` | - |
1909
- | `fnvea` | `font-variant-east-asian` | - |
1910
- | `fnve` | `font-variant-emoji` | - |
1911
- | `fnvl` | `font-variant-ligatures` | - |
1912
- | `fnvn` | `font-variant-numeric` | - |
1913
- | `fnvp` | `font-variant-position` | - |
1914
- | `fnvs` | `font-variation-settings` | - |
1915
-
1916
- ### Text
1917
-
1918
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
1919
- | -------- | --------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
1920
- | `ta` | `text-align` | `s:start`, `e:end`, `l:left`, `r:right`, `c:center`, `j:justify`, `mp:match-parent`, `mc:-moz-center`, `wc:-webkit-center` |
1921
- | `tal` | `text-align-last` | `s:start`, `e:end`, `l:left`, `r:right`, `c:center`, `j:justify` |
1922
- | `td` | `text-decoration` | `u:underline` |
1923
- | `tdc` | `text-decoration-color` | - |
1924
- | `tdl` | `text-decoration-line` | `u:underline`, `o:overline`, `lt:line-through`, `b:blink` |
1925
- | `tds` | `text-decoration-style` | `db:double`, `dt:dotted`, `ds:dashed`, `w:wavy` |
1926
- | `tdt` | `text-decoration-thickness` | `ff:from-font` |
1927
- | `tdsi` | `text-decoration-skip-ink` | - |
1928
- | `teph` | `text-emphasis` | - |
1929
- | `tec` | `text-emphasis-color` | - |
1930
- | `tep` | `text-emphasis-position` | `or:over right`, `ol:over left`, `ur:under right`, `ul:under left`, `lo:left over`, `ru:right under`, `lu:left under` |
1931
- | `tes` | `text-emphasis-style` | - |
1932
- | `ti` | `text-indent` | - |
1933
- | `tj` | `text-justify` | `iw:inter-word`, `ic:inter-character`, `d:distribute` |
1934
- | `tor` | `text-orientation` | `m:mixed`, `u:upright`, `sr:sideways-right`, `sl:sideways-left`, `s:sideways`, `ugo:use-glyph-orientation` |
1935
- | `tol` | `text-overflow` | `c:clip`, `e:ellipsis` |
1936
- | `trd` | `text-rendering` | `op:optimizeSpeed`, `ol:optimizeLegibility`, `g:geometricPrecision` |
1937
- | `tsh` | `text-shadow` | - |
1938
- | `ttr` | `text-transform` | `c:capitalize`, `u:uppercase`, `l:lowercase`, `fw:full-width`, `fsk:full-size-kana` |
1939
- | `tuo` | `text-underline-offset` | - |
1940
- | `tup` | `text-underline-position` | `u:under`, `l:left`, `r:right`, `ul:under left`, `ru:right under` |
1941
- | `tw` | `text-wrap` | `w:wrap`, `n:nowrap`, `b:balance`, `p:pretty` |
1942
-
1943
- ### Line & Spacing
1944
-
1945
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
1946
- | -------- | ---------------- | ---------------- |
1947
- | `lh` | `line-height` | - |
1948
- | `lts` | `letter-spacing` | `n:normal` |
1949
- | `wrs` | `word-spacing` | - |
1950
- | `lbrk` | `line-break` | - |
1951
- | `wrb` | `word-break` | - |
1952
- | `wrtm` | `writing-mode` | - |
1953
-
1954
- ---
1955
-
1956
- ## 6. Flexbox
1957
-
1958
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
1959
- | -------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1960
- | `fx` | `flex` | `i:0 1 auto`, `a:1 1 auto` |
1961
- | `fxb` | `flex-basis` | - |
1962
- | `fxd` | `flex-direction` | `r:row`, `rr:row-reverse`, `c:column`, `cr:column-reverse` |
1963
- | `fxf` | `flex-flow` | - |
1964
- | `fxg` | `flex-grow` | - |
1965
- | `fxs` | `flex-shrink` | - |
1966
- | `fxw` | `flex-wrap` | `w:wrap`, `wr:wrap-reverse`, `n:nowrap` |
1967
- | `jc` | `justify-content` | `c:center`, `s:start`, `e:end`, `fs:flex-start`, `fe:flex-end`, `l:left`, `r:right`, `n:normal`, `sp:space-between`, `sa:space-around`, `se:space-evenly`, `st:stretch`, `sc:safe center`, `uc:unsafe center` |
1968
- | `ai` | `align-items` | `n:normal`, `c:center`, `s:start`, `e:end`, `fs:flex-start`, `fe:flex-end`, `ss:self-start`, `se:self-end`, `b:baseline`, `fb:first baseline`, `lb:last baseline`, `sc:safe center`, `uc:unsafe center` |
1969
- | `as` | `align-self` | `n:normal`, `c:center`, `s:start`, `e:end`, `ss:self-start`, `se:self-end`, `fs:flex-start`, `fe:flex-end`, `b:baseline`, `fb:first baseline`, `lb:last baseline`, `st:stretch`, `sc:safe center`, `uc:unsafe center` |
1970
- | `ac` | `align-content` | `s:start`, `e:end`, `fs:flex-start`, `fe:flex-end`, `n:normal`, `b:baseline`, `fb:first baseline`, `lb:last baseline`, `sp:space-between`, `sa:space-around`, `se:space-evenly`, `st:stretch`, `sc:safe center`, `uc:unsafe center` |
1971
-
1972
- ---
1973
-
1974
- ## 7. Grid
1975
-
1976
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
1977
- | -------- | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1978
- | `g` | `grid` | - |
1979
- | `ga` | `grid-area` | - |
1980
- | `gc` | `grid-column` | `f:1 / -1` |
1981
- | `gce` | `grid-column-end` | - |
1982
- | `gcs` | `grid-column-start` | - |
1983
- | `gr` | `grid-row` | `f:1 / -1` |
1984
- | `gre` | `grid-row-end` | - |
1985
- | `grs` | `grid-row-start` | - |
1986
- | `gt` | `grid-template` | - |
1987
- | `gta` | `grid-template-areas` | - |
1988
- | `gtc` | `grid-template-columns` | `s:subgrid` |
1989
- | `gtr` | `grid-template-rows` | `s:subgrid` |
1990
- | `gac` | `grid-auto-columns` | `mic:min-content`, `mac:max-content`, `mm:minmax(0, 1fr)` |
1991
- | `gar` | `grid-auto-rows` | `mic:min-content`, `mac:max-content`, `mm:minmax(0, 1fr)` |
1992
- | `gaf` | `grid-auto-flow` | `r:row`, `c:column`, `d:dense`, `rd:row dense`, `cd:column dense` |
1993
- | `gap` | `gap` | - |
1994
- | `rgap` | `row-gap` | - |
1995
- | `colg` | `column-gap` | - |
1996
- | `ji` | `justify-items` | `n:normal`, `st:stretch`, `c:center`, `s:start`, `e:end`, `fs:flex-start`, `fe:flex-end`, `ss:self-start`, `se:self-end`, `l:left`, `r:right`, `b:baseline`, `fb:first baseline`, `lb:last baseline`, `lr:legacy right`, `ll:legacy left`, `lc:legacy center`, `sc:safe center`, `uc:unsafe center` |
1997
- | `js` | `justify-self` | `n:normal`, `st:stretch`, `c:center`, `s:start`, `e:end`, `fs:flex-start`, `fe:flex-end`, `ss:self-start`, `se:self-end`, `l:left`, `r:right`, `b:baseline`, `sc:safe center`, `uc:unsafe center` |
1998
- | `pli` | `place-items` | - |
1999
- | `pls` | `place-self` | - |
2000
- | `plc` | `place-content` | - |
2001
-
2002
- ---
2003
-
2004
- ## 8. Effects & Filters
2005
-
2006
- ### Opacity & Visibility
2007
-
2008
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
2009
- | -------- | ------------ | ---------------- |
2010
- | `opc` | `opacity` | - |
2011
- | `v` | `visibility` | `c:collapse` |
2012
-
2013
- ### Filter & Backdrop
2014
-
2015
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
2016
- | -------- | ----------------- | ---------------- |
2017
- | `flt` | `filter` | - |
2018
- | `bkdf` | `backdrop-filter` | - |
2019
-
2020
- ### Blend Modes
2021
-
2022
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
2023
- | -------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
2024
- | `mbd` | `mix-blend-mode` | `n:normal`, `m:multiply`, `s:screen`, `o:overlay`, `d:darken`, `l:lighten`, `cd:color-dodge`, `i:color-burn`, `hl:hard-light`, `sl:soft-light`, `di:difference`, `e:exclusion`, `h:hue`, `sa:saturation`, `c:color`, `lu:luminosity` |
2025
-
2026
- ### Box Shadow
2027
-
2028
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
2029
- | -------- | ------------ | ---------------- |
2030
- | `bxsh` | `box-shadow` | - |
2031
- | `bxshd` | `box-shadow` | - |
2032
-
2033
- ---
2034
-
2035
- ## 9. Transforms & Animations
2036
-
2037
- ### Transform
2038
-
2039
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
2040
- | -------- | ------------------ | ---------------- |
2041
- | `tra` | `transform` | - |
2042
- | `trab` | `transform-box` | - |
2043
- | `trao` | `transform-origin` | - |
2044
- | `tras` | `transform-style` | - |
2045
- | `rot` | `rotate` | - |
2046
- | `s` | `scale` | - |
2047
- | `trl` | `translate` | - |
2048
-
2049
- ### Transition
2050
-
2051
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
2052
- | --------- | ---------------------------- | ---------------- |
2053
- | `tran` | `transition` | - |
2054
- | `tranb` | `transition-behavior` | - |
2055
- | `trand` | `transition-delay` | - |
2056
- | `trandur` | `transition-duration` | - |
2057
- | `tranp` | `transition-property` | - |
2058
- | `trantf` | `transition-timing-function` | - |
2059
-
2060
- ### Animation
2061
-
2062
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
2063
- | -------- | --------------------------- | ---------------------------------------------------------------------------------------------------------------- |
2064
- | `ani` | `animation` | - |
2065
- | `anic` | `animation-composition` | `r:replace`, `a:add`, `ac:accumulate`, `ra:replace, add`, `aac:add, accumulate`, `raac:replace, add, accumulate` |
2066
- | `anide` | `animation-delay` | - |
2067
- | `anidi` | `animation-direction` | `r:reverse`, `a:alternate`, `ar:alternate-reverse`, `nr:normal, reverse`, `arn:alternate, reverse, normal` |
2068
- | `anidu` | `animation-duration` | - |
2069
- | `anifm` | `animation-fill-mode` | `f:forwards`, `b:backwards`, `nb:none, backwards`, `fbn:both, forwards, none` |
2070
- | `aniic` | `animation-iteration-count` | - |
2071
- | `anin` | `animation-name` | `s:slide` |
2072
- | `anips` | `animation-play-state` | `p:paused`, `r:running` |
2073
- | `anitf` | `animation-timing-function` | `ei:ease-in`, `eo:ease-out`, `eio:ease-in-out`, `l:linear`, `ss:step-start`, `se:step-end` |
2074
-
2075
- ---
2076
-
2077
- ## 10. Overflow & Scrolling
2078
-
2079
- ### Overflow
2080
-
2081
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
2082
- | -------- | ---------------------- | -------------------- |
2083
- | `ofl` | `overflow` | - |
2084
- | `oflx` | `overflow-x` | `c:clip`, `s:scroll` |
2085
- | `ofly` | `overflow-y` | `c:clip`, `s:scroll` |
2086
- | `oflb` | `overflow-block` | - |
2087
- | `ofli` | `overflow-inline` | - |
2088
- | `ofla` | `overflow-anchor` | - |
2089
- | `oflcm` | `overflow-clip-margin` | - |
2090
- | `oflw` | `overflow-wrap` | `c:clip`, `s:scroll` |
2091
-
2092
- ### Scroll
2093
-
2094
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
2095
- | -------- | ----------------------- | ---------------- |
2096
- | `scrb` | `scroll-behavior` | - |
2097
- | `scrm` | `scroll-margin` | - |
2098
- | `scrmb` | `scroll-margin-bottom` | - |
2099
- | `scrml` | `scroll-margin-left` | - |
2100
- | `scrmr` | `scroll-margin-right` | - |
2101
- | `scrmt` | `scroll-margin-top` | - |
2102
- | `scrp` | `scroll-padding` | - |
2103
- | `scrpb` | `scroll-padding-bottom` | - |
2104
- | `scrpl` | `scroll-padding-left` | - |
2105
- | `scrpr` | `scroll-padding-right` | - |
2106
- | `scrpt` | `scroll-padding-top` | - |
2107
- | `scrsa` | `scroll-snap-align` | - |
2108
- | `scrss` | `scroll-snap-stop` | - |
2109
- | `scrst` | `scroll-snap-type` | - |
2110
- | `sbc` | `scrollbar-color` | - |
2111
- | `sbg` | `scrollbar-gutter` | - |
2112
- | `sbw` | `scrollbar-width` | - |
2113
-
2114
- ### Overscroll
2115
-
2116
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
2117
- | -------- | ---------------------------- | ---------------- |
2118
- | `osrbh` | `overscroll-behavior` | `c:contain` |
2119
- | `osrbb` | `overscroll-behavior-block` | `c:contain` |
2120
- | `osrbi` | `overscroll-behavior-inline` | `c:contain` |
2121
- | `osrbx` | `overscroll-behavior-x` | `c:contain` |
2122
- | `orsby` | `overscroll-behavior-y` | `c:contain` |
2123
-
2124
- ---
2125
-
2126
- ## 11. Lists & Tables
2127
-
2128
- ### Lists
2129
-
2130
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
2131
- | -------- | --------------------- | ------------------------------------------------------------------------------------------------------------------- |
2132
- | `ls` | `list-style` | `i:inside`, `di:disc`, `c:circle`, `s:square`, `de:decimal`, `g:georgian`, `tci:trad-chinese-informal`, `k:kannada` |
2133
- | `lsi` | `list-style-image` | - |
2134
- | `lisp` | `list-style-position` | `i:inside`, `o:outside` |
2135
- | `lst` | `list-style-type` | `di:disc`, `c:circle`, `s:square`, `de:decimal`, `g:georgian`, `tci:trad-chinese-informal`, `k:kannada` |
2136
-
2137
- ### Tables
2138
-
2139
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
2140
- | -------- | ----------------- | -------------------------- |
2141
- | `tbl` | `table-layout` | - |
2142
- | `bdcl` | `border-collapse` | `s:separate`, `c:collapse` |
2143
- | `bdsp` | `border-spacing` | - |
2144
- | `empc` | `empty-cells` | - |
2145
- | `caps` | `caption-side` | - |
2146
-
2147
- ### Columns
2148
-
2149
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
2150
- | -------- | ------------------- | ---------------- |
2151
- | `col` | `columns` | - |
2152
- | `colc` | `column-count` | - |
2153
- | `colf` | `column-fill` | - |
2154
- | `colg` | `column-gap` | - |
2155
- | `colr` | `column-rule` | - |
2156
- | `colrc` | `column-rule-color` | - |
2157
- | `colrs` | `column-rule-style` | - |
2158
- | `colrw` | `column-rule-width` | - |
2159
- | `cols` | `column-span` | - |
2160
- | `colw` | `column-width` | - |
2161
-
2162
- ---
2163
-
2164
- ## 12. Advanced Properties
2165
-
2166
- ### Containment
2167
-
2168
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
2169
- | -------- | ------------------------------- | ---------------- |
2170
- | `cnt` | `contain` | - |
2171
- | `cntibs` | `contain-intrinsic-block-size` | - |
2172
- | `cntih` | `contain-intrinsic-height` | - |
2173
- | `cntiis` | `contain-intrinsic-inline-size` | - |
2174
- | `cntis` | `contain-intrinsic-size` | - |
2175
- | `ciw` | `contain-intrinsic-width` | - |
2176
-
2177
- ### Container Queries
2178
-
2179
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
2180
- | -------- | ---------------- | ---------------- |
2181
- | `ctr` | `container` | - |
2182
- | `ctrn` | `container-name` | - |
2183
- | `ctrt` | `container-type` | - |
2184
-
2185
- ### Content & Counters
2186
-
2187
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
2188
- | -------- | ------------------- | ---------------- |
2189
- | `ctt` | `content` | - |
2190
- | `cntri` | `counter-increment` | - |
2191
- | `cntrr` | `counter-reset` | - |
2192
- | `cntrs` | `counter-set` | - |
2193
-
2194
- ### Page Breaks
2195
-
2196
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
2197
- | -------- | ------------------- | ---------------- |
2198
- | `pg` | `page` | - |
2199
- | `pgba` | `page-break-after` | - |
2200
- | `pgbb` | `page-break-before` | - |
2201
- | `pgbi` | `page-break-inside` | - |
2202
- | `brka` | `break-after` | - |
2203
- | `brkb` | `break-before` | - |
2204
- | `brki` | `break-inside` | - |
2205
-
2206
- ### Other Advanced
2207
-
2208
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
2209
- | -------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2210
- | `a` | `all` | - |
2211
- | `is` | `isolation` | `i:isolate` |
2212
- | `z` | `z-index` | - |
2213
- | `ord` | `order` | - |
2214
- | `fl` | `float` | `is:inline-start`, `ie:inline-end`, `r:right`, `l:left` |
2215
- | `clr` | `clear` | - |
2216
- | `rsz` | `resize` | `b:both`, `h:horizontal`, `v:vertical` |
2217
- | `us` | `user-select` | `t:text`, `all:all`, `c:contain` |
2218
- | `pe` | `pointer-events` | - |
2219
- | `cr` | `cursor` | `p:pointer`, `d:default`, `cm:context-menu`, `h:help`, `pg:progress`, `w:wait`, `c:cell`, `t:text`, `vt:vertical-text`, `al:alias`, `cp:copy`, `mo:move`, `nd:no-drop`, `na:not-allowed`, `gr:grab`, `gb:grabbing`, `as:all-scroll`, `colr:col-resize`, `rr:row-resize`, `nr:n-resize`, `er:e-resize`, `sr:s-resize`, `wr:w-resize`, `ner:ne-resize`, `ser:se-resize`, `swr:sw-resize`, `ewr:ew-resize`, `nsr:ns-resize`, `nesw:nesw-resize`, `nwse:nwse-resize`, `zi:zoom-in`, `zo:zoom-out` |
2220
- | `toa` | `touch-action` | `p:pan-x`, `py:pan-y`, `pm:pan-x pan-y`, `pi:pinch-zoom` |
2221
- | `zo` | `zoom` | - |
2222
-
2223
- ---
2224
-
2225
- ## 13. WebKit Specific
2226
-
2227
- | Viết tắt | Thuộc tính | Giá trị viết tắt |
2228
- | -------- | --------------------------- | --------------------- |
2229
- | `wlc` | `-webkit-line-clamp` | - |
2230
- | `wtfc` | `-webkit-text-fill-color` | - |
2231
- | `wts` | `-webkit-text-stroke` | - |
2232
- | `wtsc` | `-webkit-text-stroke-color` | - |
2233
- | `wtsw` | `-webkit-text-stroke-width` | `m:medium`, `t:thick` |
2234
-
2235
- ---
2236
-
2237
- ## 14. Special Values
2238
-
2239
- ### Common Values
2240
-
2241
- - `n` = `none`
2242
- - `nm` = `normal`
2243
- - `a` = `auto`
2244
- - `i` = `inherit`
2245
- - `in` = `initial`
2246
- - `is` = `inline-start`
2247
- - `ie` = `inline-end`
2248
- - `tr` = `transparent`
2249
- - `c` = `center`
2250
- - `cl` = `collapse`
2251
- - `l` = `left`
2252
- - `r` = `right`
2253
- - `h` = `hidden`
2254
- - `v` = `visible`
2255
- - `s` = `start`
2256
- - `e` = `end`
2257
- - `t` = `top`
2258
- - `b` = `bottom`
2259
- - `bs` = `block-start`
2260
- - `be` = `block-end`
2261
-
2262
- ### Size Values
2263
-
2264
- - `t` = `thin`
2265
- - `m` = `medium`
2266
- - `th` = `thick`
2267
-
2268
- ### Style Values
2269
-
2270
- - `s` = `solid`
2271
- - `d` = `dotted`
2272
- - `ds` = `dashed`
2273
- - `db` = `double`
2274
- - `g` = `groove`
2275
- - `r` = `ridge`
2276
- - `i` = `inset`
2277
- - `o` = `outset`
2278
-
2279
- ---
2280
-
2281
- _Bảng tra cứu này bao gồm tất cả 409 thuộc tính CSS và giá trị viết tắt được hỗ trợ trong xCSS. Để sử dụng, hãy kết hợp viết tắt thuộc tính với giá trị viết tắt theo cú pháp: `[MQ:][layer]<property><value>[@selector]` (lưu ý: `<property><value>` là bắt buộc)_
2282
-
2283
- ### Example
2284
-
2285
- ```html
2286
-
2287
- <!DOCTYPE html>
2288
- <html lang="vi">
2289
- <head>
2290
- <meta charset="utf-8">
2291
- <meta name="viewport" content="width=device-width, initial-scale=1">
2292
- <title>Login</title>
2293
- <meta name="description" content="Mẫu HTML5 cơ bản">
2294
- <style>
2295
- :root {
2296
- --primary-color: #007bff;
2297
- --secondary-color: #6c757d;
2298
- --success-color: #28a745;
2299
- --info-color: #17a2b8;
2300
- --warning-color: #ffc107;
2301
- --danger-color: #dc3545;
2302
- --light-text: #6c757d;
2303
- --dark-text: #343a40;
2304
- --body-bg: #f8f9fa;
2305
- --div-color: #dee2e6;
2306
- --bd3:1px 1px 1px 1px #dee2e6;
2307
- --w:#fff;
2308
- }
2309
- </style>
2310
- </head>
2311
- <body>
2312
- <div class="dF jcC aiC h100vh bgc--body-bg px10px">
2313
- <div class="bgc--w p40px bda8px bxshd--bd3 w400px">
2314
- <h1 class="taC c--dark-text mb30px">Login</h1>
2315
- <div class="dF fxdC my8px">
2316
- <input class="p8px" type="text" placeholder="Username">
2317
- </div>
2318
- <div class="dF fxdC my8px">
2319
- <input class="p8px" type="password" placeholder="Password">
2320
- <a href="#" class="c--primary-color taR mt8px">
2321
- Forgot password?
2322
- </a>
2323
- </div>
2324
- <div class="taC mt30px">
2325
- <button class="bdN bgc--primary-color cWhite p12px w100% bdra4px">
2326
- Login
2327
- </button>
2328
- </div>
2329
- <div class="dF aiC my20px">
2330
- <div class="fx1 h1px bgc--div"></div>
2331
- <span class="px10px c--light-text">Or continue with</span>
2332
- <div class="fx1 h1px bgc--div"></div>
2333
- </div>
2334
- <div class="dF jcC">
2335
- <button class="bdN bgc--info-color c--w p12px mx8px dF aiC bdra4px">
2336
- <span class="ml8px">Facebook</span>
2337
- </button>
2338
- <button class="bdN bgc--success-color c--w p12px mx8px dF aiC bdra4px">
2339
-
2340
- <span class="ml8px">X-Twitter</span>
2341
- </button>
2342
- </div>
2343
- <div class="dF aiC my20px">
2344
- <div class="fx1 h1px bgc--div"></div>
2345
- </div>
2346
- <div class="taC">
2347
- <a href="#" class="p12px">
2348
- Create new account
2349
- </a>
2350
- </div>
2351
- </div>
2352
- </div>
2353
-
2354
- <script type="module">
2355
- import $ from "https://unpkg.com/@fwkui/x-css@1.0.2/index.js";
2356
- $.cssObserve(document);
2357
- </script>
2358
- </body>
2359
- </html>
2360
-
2361
- ```
44
+ );
45
+ }
46
+ ```
47
+
48
+ ## Cac quy tac viet class nhanh
49
+ Dang co ban: `[prefix:][layer][prop][value][@selector]`
50
+
51
+ - `bgc#fff` -> background-color #fff
52
+ - `p10px` -> padding 10px
53
+ - `p!10px` -> padding 10px !important
54
+ - `w--size` -> width: var(--size)
55
+ - `bg{linear-gradient(...)}` -> dung gia tri raw
56
+ - `mx10px` -> margin-left/right 10px
57
+ - `p10&bgc#fff` -> ket hop nhieu cap prop+value
58
+
59
+ ## Value ext mac dinh
60
+ ```txt
61
+ n:none
62
+ nm:normal
63
+ a:auto
64
+ i:inherit
65
+ in:initial
66
+ is:inline-start
67
+ ie:inline-end
68
+ tr:transparent
69
+ c:center
70
+ cl:collapse
71
+ l:left
72
+ r:right
73
+ h:hidden
74
+ v:visible
75
+ s:start
76
+ e:end
77
+ t:top
78
+ b:bottom
79
+ bs:block-start
80
+ be:block-end
81
+ ```
82
+
83
+ ## Cấu hình tuy chinh
84
+ ```js
85
+ import { xcss } from "@fwkui/x-css";
86
+
87
+ const { buildCss } = xcss({
88
+ css: [".app{font-family:sans-serif;}", ".box{border-radius:8px;}"],
89
+ gValue: {
90
+ btn: ["padding:8px 12px", "border-radius:6px"],
91
+ },
92
+ exNames: ["no-xcss", "legacy-*"],
93
+ mQuery: [{ tablet: "screen and (min-width: 900px)" }],
94
+ valueExt: { brand: "#0ea5e9" },
95
+ });
96
+
97
+ const engine = buildCss(document);
98
+ engine?.observe();
99
+ ```
100
+
101
+ ## Tu dien viet tat thuoc tinh (dễ tra cứu)
102
+ Để tài liệu nhẹ và dễ nhìn, **bảng từ điển đầy đủ đã được tách riêng**:
103
+ - Xem tại: `DICTIONARY.md`