create-huenei-template 0.2.2 → 0.2.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/dist/config/templates.js +3 -3
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-component/SKILL.md +288 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-component/references/component-patterns.md +358 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-di/SKILL.md +387 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-di/references/di-patterns.md +519 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-directives/SKILL.md +437 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-directives/references/directive-patterns.md +570 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-forms/SKILL.md +434 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-forms/references/form-patterns.md +398 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-http/SKILL.md +366 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-http/references/http-patterns.md +448 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-routing/SKILL.md +395 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-routing/references/routing-patterns.md +472 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-signals/SKILL.md +302 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-signals/references/signal-patterns.md +404 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-ssr/SKILL.md +435 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-ssr/references/ssr-patterns.md +497 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-testing/SKILL.md +660 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-testing/references/testing-patterns.md +707 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-tooling/SKILL.md +352 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-tooling/references/tooling-patterns.md +448 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-accessibility/SKILL.md +780 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-components/SKILL.md +718 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-design-systems/SKILL.md +612 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-layouts/SKILL.md +594 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/SKILL.md +432 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/references/animation-patterns.md +427 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/SKILL.md +354 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/references/troubleshooting-guide.md +306 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/SKILL.md +578 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/references/react-patterns.md +353 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/SKILL.md +608 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/advanced-theme-patterns.md +215 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/custom-utilities-guide.md +281 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-mobile-first/SKILL.md +768 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/SKILL.md +374 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/references/bundle-optimization.md +244 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-plugins/SKILL.md +505 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/SKILL.md +601 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/references/advanced-responsive-patterns.md +485 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/web-design-guidelines/SKILL.md +39 -0
- package/dist/templates/frontend/angular-base/package.json +0 -1
- package/dist/templates/frontend/angular-base/pnpm-lock.yaml +8183 -0
- package/package.json +1 -1
- package/templates/frontend/angular-base/.cursor/skills/angular-component/SKILL.md +288 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-component/references/component-patterns.md +358 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-di/SKILL.md +387 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-di/references/di-patterns.md +519 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-directives/SKILL.md +437 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-directives/references/directive-patterns.md +570 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-forms/SKILL.md +434 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-forms/references/form-patterns.md +398 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-http/SKILL.md +366 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-http/references/http-patterns.md +448 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-routing/SKILL.md +395 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-routing/references/routing-patterns.md +472 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-signals/SKILL.md +302 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-signals/references/signal-patterns.md +404 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-ssr/SKILL.md +435 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-ssr/references/ssr-patterns.md +497 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-testing/SKILL.md +660 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-testing/references/testing-patterns.md +707 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-tooling/SKILL.md +352 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-tooling/references/tooling-patterns.md +448 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-accessibility/SKILL.md +780 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-components/SKILL.md +718 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-design-systems/SKILL.md +612 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-layouts/SKILL.md +594 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/SKILL.md +432 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/references/animation-patterns.md +427 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/SKILL.md +354 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/references/troubleshooting-guide.md +306 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/SKILL.md +578 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/references/react-patterns.md +353 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/SKILL.md +608 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/advanced-theme-patterns.md +215 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/custom-utilities-guide.md +281 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-mobile-first/SKILL.md +768 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/SKILL.md +374 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/references/bundle-optimization.md +244 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-plugins/SKILL.md +505 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/SKILL.md +601 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/references/advanced-responsive-patterns.md +485 -0
- package/templates/frontend/angular-base/.cursor/skills/web-design-guidelines/SKILL.md +39 -0
- package/templates/frontend/angular-base/package.json +0 -1
- package/templates/frontend/angular-base/pnpm-lock.yaml +8183 -0
- package/templates/frontend/angular-base/package-lock.json +0 -13321
|
@@ -0,0 +1,768 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tailwindcss-mobile-first
|
|
3
|
+
description: Comprehensive mobile-first responsive design patterns with 2025/2026 best practices for Tailwind CSS v4
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Mobile-First Responsive Design (2025/2026)
|
|
7
|
+
|
|
8
|
+
## Core Philosophy
|
|
9
|
+
|
|
10
|
+
Mobile-first design is the **industry standard for 2025/2026**. With mobile traffic consistently exceeding 60% of global web traffic and Google's mobile-first indexing, starting with mobile ensures optimal user experience and SEO performance.
|
|
11
|
+
|
|
12
|
+
### The Mobile-First Mindset
|
|
13
|
+
|
|
14
|
+
```html
|
|
15
|
+
<!-- CORRECT: Mobile-first (progressive enhancement) -->
|
|
16
|
+
<div class="text-sm md:text-base lg:text-lg">
|
|
17
|
+
Start small, enhance upward
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<!-- INCORRECT: Desktop-first (graceful degradation) -->
|
|
21
|
+
<div class="lg:text-lg md:text-base text-sm">
|
|
22
|
+
Starts large, reduces down (more code, more bugs)
|
|
23
|
+
</div>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**Key Principle**: Unprefixed utilities apply to ALL screen sizes. Breakpoint prefixes apply at that size AND ABOVE.
|
|
27
|
+
|
|
28
|
+
## 2025/2026 Breakpoint Strategy
|
|
29
|
+
|
|
30
|
+
### Tailwind's Default Breakpoints
|
|
31
|
+
|
|
32
|
+
| Prefix | Min-width | Target Devices |
|
|
33
|
+
|--------|-----------|----------------|
|
|
34
|
+
| (none) | 0px | All mobile phones (base) |
|
|
35
|
+
| `sm:` | 640px (40rem) | Large phones, small tablets |
|
|
36
|
+
| `md:` | 768px (48rem) | Tablets (portrait) |
|
|
37
|
+
| `lg:` | 1024px (64rem) | Tablets (landscape), laptops |
|
|
38
|
+
| `xl:` | 1280px (80rem) | Desktops |
|
|
39
|
+
| `2xl:` | 1536px (96rem) | Large desktops |
|
|
40
|
+
|
|
41
|
+
### Content-Driven Breakpoints
|
|
42
|
+
|
|
43
|
+
**Best Practice 2025/2026**: Let content determine breakpoints, not device dimensions.
|
|
44
|
+
|
|
45
|
+
```css
|
|
46
|
+
@theme {
|
|
47
|
+
/* Override defaults based on YOUR content needs */
|
|
48
|
+
--breakpoint-sm: 36rem; /* 576px - when your content needs more space */
|
|
49
|
+
--breakpoint-md: 48rem; /* 768px */
|
|
50
|
+
--breakpoint-lg: 62rem; /* 992px - common content width */
|
|
51
|
+
--breakpoint-xl: 75rem; /* 1200px */
|
|
52
|
+
--breakpoint-2xl: 90rem; /* 1440px */
|
|
53
|
+
|
|
54
|
+
/* Add custom breakpoints for specific content needs */
|
|
55
|
+
--breakpoint-xs: 20rem; /* 320px - very small devices */
|
|
56
|
+
--breakpoint-3xl: 120rem; /* 1920px - ultra-wide */
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Screen Coverage Strategy
|
|
61
|
+
|
|
62
|
+
```html
|
|
63
|
+
<!-- Cover the most common device ranges (2025/2026 data) -->
|
|
64
|
+
|
|
65
|
+
<!-- 375px-430px: ~50% of mobile devices (iPhone, modern Android) -->
|
|
66
|
+
<div class="px-4">Mobile base</div>
|
|
67
|
+
|
|
68
|
+
<!-- 768px+: Tablets and small laptops -->
|
|
69
|
+
<div class="px-4 md:px-6">Tablet enhancement</div>
|
|
70
|
+
|
|
71
|
+
<!-- 1024px+: Desktop experience -->
|
|
72
|
+
<div class="px-4 md:px-6 lg:px-8">Desktop enhancement</div>
|
|
73
|
+
|
|
74
|
+
<!-- 1440px+: Wide desktop experience -->
|
|
75
|
+
<div class="px-4 md:px-6 lg:px-8 xl:px-12">Wide desktop</div>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Fluid Typography System
|
|
79
|
+
|
|
80
|
+
### CSS Clamp for Smooth Scaling
|
|
81
|
+
|
|
82
|
+
Fluid typography eliminates jarring size jumps between breakpoints:
|
|
83
|
+
|
|
84
|
+
```css
|
|
85
|
+
@theme {
|
|
86
|
+
/* Fluid typography scale */
|
|
87
|
+
--text-fluid-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
|
|
88
|
+
--text-fluid-sm: clamp(0.875rem, 0.8rem + 0.375vw, 1rem);
|
|
89
|
+
--text-fluid-base: clamp(1rem, 0.9rem + 0.5vw, 1.125rem);
|
|
90
|
+
--text-fluid-lg: clamp(1.125rem, 1rem + 0.625vw, 1.25rem);
|
|
91
|
+
--text-fluid-xl: clamp(1.25rem, 1rem + 1.25vw, 1.5rem);
|
|
92
|
+
--text-fluid-2xl: clamp(1.5rem, 1.1rem + 2vw, 2rem);
|
|
93
|
+
--text-fluid-3xl: clamp(1.875rem, 1.2rem + 3.375vw, 2.5rem);
|
|
94
|
+
--text-fluid-4xl: clamp(2.25rem, 1rem + 6.25vw, 3.5rem);
|
|
95
|
+
--text-fluid-5xl: clamp(3rem, 1rem + 10vw, 5rem);
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Important for Accessibility**: Always combine `vw` with `rem` to respect user zoom preferences (WCAG compliance).
|
|
100
|
+
|
|
101
|
+
### Using Fluid Typography
|
|
102
|
+
|
|
103
|
+
```html
|
|
104
|
+
<!-- Fluid heading that scales smoothly -->
|
|
105
|
+
<h1 class="text-fluid-4xl font-bold leading-tight">
|
|
106
|
+
Responsive Heading
|
|
107
|
+
</h1>
|
|
108
|
+
|
|
109
|
+
<!-- Fluid body text -->
|
|
110
|
+
<p class="text-fluid-base leading-relaxed max-w-prose">
|
|
111
|
+
Body text that scales proportionally with the viewport
|
|
112
|
+
while respecting user's font size preferences.
|
|
113
|
+
</p>
|
|
114
|
+
|
|
115
|
+
<!-- Fluid with breakpoint overrides for fine control -->
|
|
116
|
+
<h2 class="text-fluid-2xl lg:text-fluid-3xl font-semibold">
|
|
117
|
+
Section Title
|
|
118
|
+
</h2>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Fluid Spacing System
|
|
122
|
+
|
|
123
|
+
### Clamp-Based Spacing
|
|
124
|
+
|
|
125
|
+
```css
|
|
126
|
+
@theme {
|
|
127
|
+
/* Fluid spacing scale */
|
|
128
|
+
--spacing-fluid-xs: clamp(0.25rem, 0.2rem + 0.25vw, 0.5rem);
|
|
129
|
+
--spacing-fluid-sm: clamp(0.5rem, 0.4rem + 0.5vw, 1rem);
|
|
130
|
+
--spacing-fluid-md: clamp(1rem, 0.75rem + 1.25vw, 2rem);
|
|
131
|
+
--spacing-fluid-lg: clamp(1.5rem, 1rem + 2.5vw, 3rem);
|
|
132
|
+
--spacing-fluid-xl: clamp(2rem, 1.25rem + 3.75vw, 4rem);
|
|
133
|
+
--spacing-fluid-2xl: clamp(3rem, 1.5rem + 7.5vw, 6rem);
|
|
134
|
+
--spacing-fluid-section: clamp(4rem, 2rem + 10vw, 8rem);
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Using Fluid Spacing
|
|
139
|
+
|
|
140
|
+
```html
|
|
141
|
+
<!-- Fluid section padding -->
|
|
142
|
+
<section class="py-fluid-section px-fluid-md">
|
|
143
|
+
<div class="max-w-7xl mx-auto">
|
|
144
|
+
<h2 class="mb-fluid-lg">Section Title</h2>
|
|
145
|
+
<div class="grid gap-fluid-md grid-cols-1 md:grid-cols-2 lg:grid-cols-3">
|
|
146
|
+
<!-- Cards -->
|
|
147
|
+
</div>
|
|
148
|
+
</div>
|
|
149
|
+
</section>
|
|
150
|
+
|
|
151
|
+
<!-- Hero section with fluid spacing -->
|
|
152
|
+
<header class="min-h-screen flex items-center py-fluid-2xl px-fluid-md">
|
|
153
|
+
<div class="max-w-4xl">
|
|
154
|
+
<h1 class="text-fluid-5xl mb-fluid-md">Hero Title</h1>
|
|
155
|
+
<p class="text-fluid-lg mb-fluid-lg">Hero description</p>
|
|
156
|
+
<button class="px-fluid-md py-fluid-sm">Get Started</button>
|
|
157
|
+
</div>
|
|
158
|
+
</header>
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Touch-Friendly Interactive Elements
|
|
162
|
+
|
|
163
|
+
### WCAG 2.2 Touch Target Requirements
|
|
164
|
+
|
|
165
|
+
**Minimum sizes (2025 standards)**:
|
|
166
|
+
- **WCAG 2.2 Level AA**: 24x24 CSS pixels minimum
|
|
167
|
+
- **Recommended**: 44x44 CSS pixels (Apple, Google, Microsoft guidelines)
|
|
168
|
+
- **Optimal**: 48x48 CSS pixels for critical actions
|
|
169
|
+
|
|
170
|
+
```html
|
|
171
|
+
<!-- WCAG 2.2 compliant touch targets -->
|
|
172
|
+
|
|
173
|
+
<!-- Minimum AA compliant (24px) -->
|
|
174
|
+
<button class="min-h-6 min-w-6 p-1">
|
|
175
|
+
<svg class="h-4 w-4">...</svg>
|
|
176
|
+
</button>
|
|
177
|
+
|
|
178
|
+
<!-- Recommended size (44px) -->
|
|
179
|
+
<button class="min-h-11 min-w-11 p-2.5">
|
|
180
|
+
<svg class="h-6 w-6">...</svg>
|
|
181
|
+
<span class="sr-only">Action</span>
|
|
182
|
+
</button>
|
|
183
|
+
|
|
184
|
+
<!-- Optimal for primary actions (48px) -->
|
|
185
|
+
<button class="min-h-12 min-w-12 px-6 py-3 text-base">
|
|
186
|
+
Primary Action
|
|
187
|
+
</button>
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Extended Touch Targets
|
|
191
|
+
|
|
192
|
+
```html
|
|
193
|
+
<!-- Extend touch target beyond visible element -->
|
|
194
|
+
<a href="/link" class="relative inline-block text-sm">
|
|
195
|
+
Small visible link
|
|
196
|
+
<!-- Invisible extended touch area -->
|
|
197
|
+
<span class="absolute -inset-3" aria-hidden="true"></span>
|
|
198
|
+
</a>
|
|
199
|
+
|
|
200
|
+
<!-- Icon button with extended target -->
|
|
201
|
+
<button class="relative p-2 -m-2 rounded-lg hover:bg-gray-100">
|
|
202
|
+
<svg class="h-5 w-5" aria-hidden="true">...</svg>
|
|
203
|
+
<span class="sr-only">Close</span>
|
|
204
|
+
</button>
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Touch Target Spacing
|
|
208
|
+
|
|
209
|
+
```html
|
|
210
|
+
<!-- Adequate spacing between touch targets (minimum 8px gap) -->
|
|
211
|
+
<nav class="flex gap-3">
|
|
212
|
+
<a href="#" class="min-h-11 px-4 py-2.5">Home</a>
|
|
213
|
+
<a href="#" class="min-h-11 px-4 py-2.5">About</a>
|
|
214
|
+
<a href="#" class="min-h-11 px-4 py-2.5">Contact</a>
|
|
215
|
+
</nav>
|
|
216
|
+
|
|
217
|
+
<!-- Stacked navigation with adequate spacing -->
|
|
218
|
+
<nav class="flex flex-col">
|
|
219
|
+
<a href="#" class="py-3 px-4 min-h-11 border-b border-gray-100">Link 1</a>
|
|
220
|
+
<a href="#" class="py-3 px-4 min-h-11 border-b border-gray-100">Link 2</a>
|
|
221
|
+
<a href="#" class="py-3 px-4 min-h-11">Link 3</a>
|
|
222
|
+
</nav>
|
|
223
|
+
|
|
224
|
+
<!-- Button group with safe spacing -->
|
|
225
|
+
<div class="flex flex-wrap gap-3">
|
|
226
|
+
<button class="min-h-11 px-4 py-2">Cancel</button>
|
|
227
|
+
<button class="min-h-11 px-4 py-2 bg-blue-600 text-white">Confirm</button>
|
|
228
|
+
</div>
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## Container Queries (2025 Game-Changer)
|
|
232
|
+
|
|
233
|
+
Container queries enable **component-level responsiveness**, independent of viewport size.
|
|
234
|
+
|
|
235
|
+
### Setup
|
|
236
|
+
|
|
237
|
+
```css
|
|
238
|
+
@import "tailwindcss";
|
|
239
|
+
@plugin "@tailwindcss/container-queries";
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Container Query Breakpoints
|
|
243
|
+
|
|
244
|
+
| Class | Min-width |
|
|
245
|
+
|-------|-----------|
|
|
246
|
+
| `@xs` | 20rem (320px) |
|
|
247
|
+
| `@sm` | 24rem (384px) |
|
|
248
|
+
| `@md` | 28rem (448px) |
|
|
249
|
+
| `@lg` | 32rem (512px) |
|
|
250
|
+
| `@xl` | 36rem (576px) |
|
|
251
|
+
| `@2xl` | 42rem (672px) |
|
|
252
|
+
| `@3xl` | 48rem (768px) |
|
|
253
|
+
| `@4xl` | 56rem (896px) |
|
|
254
|
+
| `@5xl` | 64rem (1024px) |
|
|
255
|
+
|
|
256
|
+
### Practical Container Query Patterns
|
|
257
|
+
|
|
258
|
+
```html
|
|
259
|
+
<!-- Card that responds to its container, not viewport -->
|
|
260
|
+
<article class="@container">
|
|
261
|
+
<div class="
|
|
262
|
+
flex flex-col @sm:flex-row
|
|
263
|
+
gap-4 p-4
|
|
264
|
+
bg-white rounded-xl shadow-sm
|
|
265
|
+
">
|
|
266
|
+
<img
|
|
267
|
+
src="..."
|
|
268
|
+
class="
|
|
269
|
+
w-full @sm:w-32 @lg:w-48
|
|
270
|
+
aspect-video @sm:aspect-square
|
|
271
|
+
object-cover rounded-lg
|
|
272
|
+
"
|
|
273
|
+
/>
|
|
274
|
+
<div class="flex-1 min-w-0">
|
|
275
|
+
<h3 class="text-base @md:text-lg @lg:text-xl font-semibold truncate">
|
|
276
|
+
Card Title
|
|
277
|
+
</h3>
|
|
278
|
+
<p class="
|
|
279
|
+
text-sm @md:text-base
|
|
280
|
+
text-gray-600
|
|
281
|
+
line-clamp-2 @lg:line-clamp-3
|
|
282
|
+
mt-2
|
|
283
|
+
">
|
|
284
|
+
Description that adapts to available space...
|
|
285
|
+
</p>
|
|
286
|
+
<div class="mt-4 flex flex-wrap gap-2 @md:gap-3">
|
|
287
|
+
<span class="text-xs @md:text-sm px-2 py-1 bg-gray-100 rounded">Tag</span>
|
|
288
|
+
</div>
|
|
289
|
+
</div>
|
|
290
|
+
</div>
|
|
291
|
+
</article>
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### Named Containers
|
|
295
|
+
|
|
296
|
+
```html
|
|
297
|
+
<div class="@container/sidebar w-64">
|
|
298
|
+
<nav class="
|
|
299
|
+
flex flex-col @lg/sidebar:flex-row
|
|
300
|
+
@lg/sidebar:items-center
|
|
301
|
+
gap-2 @lg/sidebar:gap-4
|
|
302
|
+
">
|
|
303
|
+
<a href="#">Link 1</a>
|
|
304
|
+
<a href="#">Link 2</a>
|
|
305
|
+
</nav>
|
|
306
|
+
</div>
|
|
307
|
+
|
|
308
|
+
<main class="@container/main flex-1">
|
|
309
|
+
<div class="
|
|
310
|
+
grid grid-cols-1
|
|
311
|
+
@md/main:grid-cols-2
|
|
312
|
+
@xl/main:grid-cols-3
|
|
313
|
+
gap-6
|
|
314
|
+
">
|
|
315
|
+
<!-- Grid items respond to main container -->
|
|
316
|
+
</div>
|
|
317
|
+
</main>
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### When to Use Container vs Viewport Queries
|
|
321
|
+
|
|
322
|
+
| Use Container Queries | Use Viewport Queries |
|
|
323
|
+
|----------------------|---------------------|
|
|
324
|
+
| Reusable components | Page-level layouts |
|
|
325
|
+
| Sidebar widgets | Navigation bars |
|
|
326
|
+
| Card grids | Hero sections |
|
|
327
|
+
| Embedded content | Full-width sections |
|
|
328
|
+
| CMS/dynamic content | Fixed app shells |
|
|
329
|
+
|
|
330
|
+
## Responsive Layout Patterns
|
|
331
|
+
|
|
332
|
+
### Mobile-First Grid System
|
|
333
|
+
|
|
334
|
+
```html
|
|
335
|
+
<!-- Auto-responsive grid with minimum card width -->
|
|
336
|
+
<div class="
|
|
337
|
+
grid gap-6
|
|
338
|
+
grid-cols-1
|
|
339
|
+
sm:grid-cols-2
|
|
340
|
+
lg:grid-cols-3
|
|
341
|
+
xl:grid-cols-4
|
|
342
|
+
">
|
|
343
|
+
<!-- Cards automatically flow -->
|
|
344
|
+
</div>
|
|
345
|
+
|
|
346
|
+
<!-- CSS Grid auto-fit (no breakpoints needed) -->
|
|
347
|
+
<div class="grid grid-cols-[repeat(auto-fit,minmax(280px,1fr))] gap-6">
|
|
348
|
+
<!-- Cards auto-fit with 280px minimum -->
|
|
349
|
+
</div>
|
|
350
|
+
|
|
351
|
+
<!-- CSS Grid auto-fill for fixed-size items -->
|
|
352
|
+
<div class="grid grid-cols-[repeat(auto-fill,minmax(200px,1fr))] gap-4">
|
|
353
|
+
<!-- Fixed minimum size, grows to fill -->
|
|
354
|
+
</div>
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
### Responsive Flexbox Patterns
|
|
358
|
+
|
|
359
|
+
```html
|
|
360
|
+
<!-- Stack to row -->
|
|
361
|
+
<div class="flex flex-col md:flex-row gap-4">
|
|
362
|
+
<div class="flex-1">Content 1</div>
|
|
363
|
+
<div class="flex-1">Content 2</div>
|
|
364
|
+
</div>
|
|
365
|
+
|
|
366
|
+
<!-- Wrap with centered items -->
|
|
367
|
+
<div class="flex flex-wrap justify-center gap-4">
|
|
368
|
+
<div class="w-full sm:w-auto">Item 1</div>
|
|
369
|
+
<div class="w-full sm:w-auto">Item 2</div>
|
|
370
|
+
<div class="w-full sm:w-auto">Item 3</div>
|
|
371
|
+
</div>
|
|
372
|
+
|
|
373
|
+
<!-- Mobile stack, desktop inline with push -->
|
|
374
|
+
<div class="flex flex-col sm:flex-row sm:items-center gap-4">
|
|
375
|
+
<div class="flex-1">
|
|
376
|
+
<h3>Title</h3>
|
|
377
|
+
<p class="text-sm text-gray-600">Description</p>
|
|
378
|
+
</div>
|
|
379
|
+
<button class="sm:ml-auto min-h-11 px-4 py-2">Action</button>
|
|
380
|
+
</div>
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
### Responsive Sidebar Layouts
|
|
384
|
+
|
|
385
|
+
```html
|
|
386
|
+
<!-- Collapsible sidebar -->
|
|
387
|
+
<div class="flex min-h-screen">
|
|
388
|
+
<!-- Sidebar: hidden on mobile, visible on desktop -->
|
|
389
|
+
<aside class="
|
|
390
|
+
hidden lg:flex lg:flex-col
|
|
391
|
+
w-64 border-r bg-gray-50
|
|
392
|
+
">
|
|
393
|
+
<nav class="flex-1 p-4">...</nav>
|
|
394
|
+
</aside>
|
|
395
|
+
|
|
396
|
+
<!-- Main content -->
|
|
397
|
+
<main class="flex-1 p-4 lg:p-8">
|
|
398
|
+
Content
|
|
399
|
+
</main>
|
|
400
|
+
</div>
|
|
401
|
+
|
|
402
|
+
<!-- Mobile drawer + desktop sidebar -->
|
|
403
|
+
<div class="relative flex min-h-screen">
|
|
404
|
+
<!-- Mobile drawer overlay -->
|
|
405
|
+
<div class="
|
|
406
|
+
fixed inset-0 z-40 lg:hidden
|
|
407
|
+
bg-black/50
|
|
408
|
+
data-[open=false]:hidden
|
|
409
|
+
" data-open="false">
|
|
410
|
+
<aside class="w-64 h-full bg-white">
|
|
411
|
+
Mobile navigation
|
|
412
|
+
</aside>
|
|
413
|
+
</div>
|
|
414
|
+
|
|
415
|
+
<!-- Desktop sidebar -->
|
|
416
|
+
<aside class="hidden lg:block w-64 border-r">
|
|
417
|
+
Desktop navigation
|
|
418
|
+
</aside>
|
|
419
|
+
|
|
420
|
+
<main class="flex-1">Content</main>
|
|
421
|
+
</div>
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
### Holy Grail Layout (2025)
|
|
425
|
+
|
|
426
|
+
```html
|
|
427
|
+
<div class="min-h-screen grid grid-rows-[auto_1fr_auto]">
|
|
428
|
+
<!-- Header -->
|
|
429
|
+
<header class="sticky top-0 z-50 h-16 bg-white border-b shadow-sm">
|
|
430
|
+
<nav class="h-full max-w-7xl mx-auto px-4 flex items-center justify-between">
|
|
431
|
+
<Logo />
|
|
432
|
+
<ul class="hidden md:flex gap-6">...</ul>
|
|
433
|
+
<button class="md:hidden min-h-11 min-w-11">Menu</button>
|
|
434
|
+
</nav>
|
|
435
|
+
</header>
|
|
436
|
+
|
|
437
|
+
<!-- Main content area with optional sidebars -->
|
|
438
|
+
<div class="
|
|
439
|
+
grid
|
|
440
|
+
grid-cols-1
|
|
441
|
+
md:grid-cols-[240px_1fr]
|
|
442
|
+
lg:grid-cols-[240px_1fr_280px]
|
|
443
|
+
gap-0
|
|
444
|
+
">
|
|
445
|
+
<nav class="hidden md:block border-r p-4">Left Nav</nav>
|
|
446
|
+
<main class="p-4 md:p-6 lg:p-8">Main Content</main>
|
|
447
|
+
<aside class="hidden lg:block border-l p-4">Right Sidebar</aside>
|
|
448
|
+
</div>
|
|
449
|
+
|
|
450
|
+
<!-- Footer -->
|
|
451
|
+
<footer class="bg-gray-900 text-white py-8 md:py-12">
|
|
452
|
+
Footer content
|
|
453
|
+
</footer>
|
|
454
|
+
</div>
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
## Responsive Images
|
|
458
|
+
|
|
459
|
+
### Aspect Ratio Containers
|
|
460
|
+
|
|
461
|
+
```html
|
|
462
|
+
<!-- Maintain aspect ratio across all sizes -->
|
|
463
|
+
<div class="aspect-video overflow-hidden rounded-lg">
|
|
464
|
+
<img src="..." class="w-full h-full object-cover" loading="lazy" />
|
|
465
|
+
</div>
|
|
466
|
+
|
|
467
|
+
<!-- Responsive aspect ratio -->
|
|
468
|
+
<div class="aspect-square sm:aspect-video lg:aspect-[4/3] overflow-hidden">
|
|
469
|
+
<img src="..." class="w-full h-full object-cover" />
|
|
470
|
+
</div>
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
### Responsive Image Sizes
|
|
474
|
+
|
|
475
|
+
```html
|
|
476
|
+
<!-- Art direction with picture element -->
|
|
477
|
+
<picture>
|
|
478
|
+
<source media="(min-width: 1024px)" srcset="large.jpg" />
|
|
479
|
+
<source media="(min-width: 640px)" srcset="medium.jpg" />
|
|
480
|
+
<img
|
|
481
|
+
src="small.jpg"
|
|
482
|
+
alt="Description"
|
|
483
|
+
class="w-full h-auto rounded-lg"
|
|
484
|
+
loading="lazy"
|
|
485
|
+
/>
|
|
486
|
+
</picture>
|
|
487
|
+
|
|
488
|
+
<!-- Responsive srcset -->
|
|
489
|
+
<img
|
|
490
|
+
src="image-800.jpg"
|
|
491
|
+
srcset="
|
|
492
|
+
image-400.jpg 400w,
|
|
493
|
+
image-800.jpg 800w,
|
|
494
|
+
image-1200.jpg 1200w,
|
|
495
|
+
image-1600.jpg 1600w
|
|
496
|
+
"
|
|
497
|
+
sizes="
|
|
498
|
+
(min-width: 1280px) 1200px,
|
|
499
|
+
(min-width: 768px) 80vw,
|
|
500
|
+
100vw
|
|
501
|
+
"
|
|
502
|
+
alt="Responsive image"
|
|
503
|
+
class="w-full h-auto"
|
|
504
|
+
loading="lazy"
|
|
505
|
+
/>
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
## Responsive Typography Patterns
|
|
509
|
+
|
|
510
|
+
### Heading Hierarchy
|
|
511
|
+
|
|
512
|
+
```html
|
|
513
|
+
<!-- Mobile-first heading scale -->
|
|
514
|
+
<h1 class="
|
|
515
|
+
text-2xl sm:text-3xl md:text-4xl lg:text-5xl xl:text-6xl
|
|
516
|
+
font-bold leading-tight tracking-tight
|
|
517
|
+
">
|
|
518
|
+
Main Heading
|
|
519
|
+
</h1>
|
|
520
|
+
|
|
521
|
+
<h2 class="
|
|
522
|
+
text-xl sm:text-2xl md:text-3xl lg:text-4xl
|
|
523
|
+
font-semibold leading-snug
|
|
524
|
+
">
|
|
525
|
+
Section Heading
|
|
526
|
+
</h2>
|
|
527
|
+
|
|
528
|
+
<h3 class="
|
|
529
|
+
text-lg sm:text-xl md:text-2xl
|
|
530
|
+
font-medium
|
|
531
|
+
">
|
|
532
|
+
Subsection Heading
|
|
533
|
+
</h3>
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
### Readable Body Text
|
|
537
|
+
|
|
538
|
+
```html
|
|
539
|
+
<!-- Optimal line length and spacing -->
|
|
540
|
+
<article class="max-w-prose mx-auto">
|
|
541
|
+
<p class="
|
|
542
|
+
text-base md:text-lg
|
|
543
|
+
leading-relaxed md:leading-loose
|
|
544
|
+
text-gray-700 dark:text-gray-300
|
|
545
|
+
">
|
|
546
|
+
Body text optimized for readability with 45-75 characters per line.
|
|
547
|
+
</p>
|
|
548
|
+
</article>
|
|
549
|
+
|
|
550
|
+
<!-- Text that balances across lines -->
|
|
551
|
+
<h2 class="text-balance text-2xl md:text-3xl font-bold max-w-2xl">
|
|
552
|
+
This heading will balance text across lines to avoid orphans
|
|
553
|
+
</h2>
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
## Mobile Navigation Patterns
|
|
557
|
+
|
|
558
|
+
### Hamburger to Full Nav
|
|
559
|
+
|
|
560
|
+
```html
|
|
561
|
+
<nav class="relative">
|
|
562
|
+
<!-- Desktop navigation -->
|
|
563
|
+
<ul class="hidden md:flex items-center gap-6">
|
|
564
|
+
<li><a href="#" class="py-2 hover:text-blue-600">Home</a></li>
|
|
565
|
+
<li><a href="#" class="py-2 hover:text-blue-600">Products</a></li>
|
|
566
|
+
<li><a href="#" class="py-2 hover:text-blue-600">About</a></li>
|
|
567
|
+
<li><a href="#" class="py-2 hover:text-blue-600">Contact</a></li>
|
|
568
|
+
</ul>
|
|
569
|
+
|
|
570
|
+
<!-- Mobile menu button -->
|
|
571
|
+
<button
|
|
572
|
+
class="md:hidden min-h-11 min-w-11 p-2"
|
|
573
|
+
aria-expanded="false"
|
|
574
|
+
aria-controls="mobile-menu"
|
|
575
|
+
aria-label="Toggle navigation menu"
|
|
576
|
+
>
|
|
577
|
+
<svg class="h-6 w-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
578
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"/>
|
|
579
|
+
</svg>
|
|
580
|
+
</button>
|
|
581
|
+
|
|
582
|
+
<!-- Mobile menu (controlled via JS) -->
|
|
583
|
+
<div
|
|
584
|
+
id="mobile-menu"
|
|
585
|
+
class="
|
|
586
|
+
md:hidden
|
|
587
|
+
absolute top-full left-0 right-0
|
|
588
|
+
bg-white shadow-lg border-t
|
|
589
|
+
hidden
|
|
590
|
+
"
|
|
591
|
+
>
|
|
592
|
+
<ul class="py-2">
|
|
593
|
+
<li><a href="#" class="block px-4 py-3 min-h-11 hover:bg-gray-50">Home</a></li>
|
|
594
|
+
<li><a href="#" class="block px-4 py-3 min-h-11 hover:bg-gray-50">Products</a></li>
|
|
595
|
+
<li><a href="#" class="block px-4 py-3 min-h-11 hover:bg-gray-50">About</a></li>
|
|
596
|
+
<li><a href="#" class="block px-4 py-3 min-h-11 hover:bg-gray-50">Contact</a></li>
|
|
597
|
+
</ul>
|
|
598
|
+
</div>
|
|
599
|
+
</nav>
|
|
600
|
+
```
|
|
601
|
+
|
|
602
|
+
### Bottom Navigation (Mobile App Style)
|
|
603
|
+
|
|
604
|
+
```html
|
|
605
|
+
<!-- Fixed bottom navigation for mobile -->
|
|
606
|
+
<nav class="
|
|
607
|
+
fixed bottom-0 inset-x-0 z-50
|
|
608
|
+
md:hidden
|
|
609
|
+
bg-white border-t shadow-lg
|
|
610
|
+
safe-area-pb
|
|
611
|
+
">
|
|
612
|
+
<ul class="flex justify-around">
|
|
613
|
+
<li>
|
|
614
|
+
<a href="#" class="
|
|
615
|
+
flex flex-col items-center
|
|
616
|
+
min-h-14 min-w-14 px-3 py-2
|
|
617
|
+
text-xs
|
|
618
|
+
text-gray-600 hover:text-blue-600
|
|
619
|
+
aria-current:text-blue-600
|
|
620
|
+
">
|
|
621
|
+
<svg class="h-6 w-6 mb-1">...</svg>
|
|
622
|
+
Home
|
|
623
|
+
</a>
|
|
624
|
+
</li>
|
|
625
|
+
<li>
|
|
626
|
+
<a href="#" class="flex flex-col items-center min-h-14 min-w-14 px-3 py-2 text-xs">
|
|
627
|
+
<svg class="h-6 w-6 mb-1">...</svg>
|
|
628
|
+
Search
|
|
629
|
+
</a>
|
|
630
|
+
</li>
|
|
631
|
+
<li>
|
|
632
|
+
<a href="#" class="flex flex-col items-center min-h-14 min-w-14 px-3 py-2 text-xs">
|
|
633
|
+
<svg class="h-6 w-6 mb-1">...</svg>
|
|
634
|
+
Profile
|
|
635
|
+
</a>
|
|
636
|
+
</li>
|
|
637
|
+
</ul>
|
|
638
|
+
</nav>
|
|
639
|
+
|
|
640
|
+
<!-- Add padding to main content to prevent overlap -->
|
|
641
|
+
<main class="pb-20 md:pb-0">
|
|
642
|
+
Content
|
|
643
|
+
</main>
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
## Safe Area Handling (Notched Devices)
|
|
647
|
+
|
|
648
|
+
```css
|
|
649
|
+
@utility safe-area-pt {
|
|
650
|
+
padding-top: env(safe-area-inset-top);
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
@utility safe-area-pb {
|
|
654
|
+
padding-bottom: env(safe-area-inset-bottom);
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
@utility safe-area-pl {
|
|
658
|
+
padding-left: env(safe-area-inset-left);
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
@utility safe-area-pr {
|
|
662
|
+
padding-right: env(safe-area-inset-right);
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
@utility safe-area-p {
|
|
666
|
+
padding-top: env(safe-area-inset-top);
|
|
667
|
+
padding-right: env(safe-area-inset-right);
|
|
668
|
+
padding-bottom: env(safe-area-inset-bottom);
|
|
669
|
+
padding-left: env(safe-area-inset-left);
|
|
670
|
+
}
|
|
671
|
+
```
|
|
672
|
+
|
|
673
|
+
```html
|
|
674
|
+
<!-- Header that respects notch -->
|
|
675
|
+
<header class="sticky top-0 safe-area-pt bg-white">
|
|
676
|
+
<div class="h-16 flex items-center px-4">
|
|
677
|
+
Navigation
|
|
678
|
+
</div>
|
|
679
|
+
</header>
|
|
680
|
+
|
|
681
|
+
<!-- Bottom navigation with safe area -->
|
|
682
|
+
<nav class="fixed bottom-0 inset-x-0 safe-area-pb bg-white border-t">
|
|
683
|
+
Bottom nav
|
|
684
|
+
</nav>
|
|
685
|
+
```
|
|
686
|
+
|
|
687
|
+
## Performance Optimization for Mobile
|
|
688
|
+
|
|
689
|
+
### Lazy Loading
|
|
690
|
+
|
|
691
|
+
```html
|
|
692
|
+
<!-- Native lazy loading for images -->
|
|
693
|
+
<img src="image.jpg" alt="..." loading="lazy" class="w-full h-auto" />
|
|
694
|
+
|
|
695
|
+
<!-- Lazy load below-fold content -->
|
|
696
|
+
<div class="contents" data-lazy-load>
|
|
697
|
+
Heavy component loaded on demand
|
|
698
|
+
</div>
|
|
699
|
+
```
|
|
700
|
+
|
|
701
|
+
### Content Visibility
|
|
702
|
+
|
|
703
|
+
```css
|
|
704
|
+
@utility content-auto {
|
|
705
|
+
content-visibility: auto;
|
|
706
|
+
contain-intrinsic-size: auto 500px;
|
|
707
|
+
}
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
```html
|
|
711
|
+
<!-- Skip rendering off-screen content -->
|
|
712
|
+
<section class="content-auto">
|
|
713
|
+
Large section that may be off-screen
|
|
714
|
+
</section>
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
### Reduced Data Usage
|
|
718
|
+
|
|
719
|
+
```html
|
|
720
|
+
<!-- Show simpler version on slow connections -->
|
|
721
|
+
<picture>
|
|
722
|
+
<source
|
|
723
|
+
srcset="video-poster.jpg"
|
|
724
|
+
media="(prefers-reduced-data: reduce)"
|
|
725
|
+
/>
|
|
726
|
+
<img src="animated.gif" alt="..." />
|
|
727
|
+
</picture>
|
|
728
|
+
```
|
|
729
|
+
|
|
730
|
+
## Responsive Testing Checklist
|
|
731
|
+
|
|
732
|
+
### Essential Tests
|
|
733
|
+
|
|
734
|
+
1. **320px** - Smallest supported width (older iPhones)
|
|
735
|
+
2. **375px** - Modern iPhone base
|
|
736
|
+
3. **414px** - Large phones (iPhone Plus/Max)
|
|
737
|
+
4. **768px** - iPad portrait
|
|
738
|
+
5. **1024px** - iPad landscape / small laptop
|
|
739
|
+
6. **1280px** - Standard laptop
|
|
740
|
+
7. **1440px** - Large desktop
|
|
741
|
+
8. **1920px** - Full HD desktop
|
|
742
|
+
|
|
743
|
+
### Quality Checks
|
|
744
|
+
|
|
745
|
+
- [ ] Text remains readable at all sizes
|
|
746
|
+
- [ ] Touch targets are minimum 44px on mobile
|
|
747
|
+
- [ ] No horizontal scroll on any viewport
|
|
748
|
+
- [ ] Images don't overflow containers
|
|
749
|
+
- [ ] Navigation is accessible on all sizes
|
|
750
|
+
- [ ] Forms are usable on mobile
|
|
751
|
+
- [ ] Modals fit mobile screens
|
|
752
|
+
- [ ] Tables have mobile alternatives
|
|
753
|
+
- [ ] Performance under 3s LCP on 3G
|
|
754
|
+
|
|
755
|
+
## Best Practices Summary
|
|
756
|
+
|
|
757
|
+
| Practice | Implementation |
|
|
758
|
+
|----------|---------------|
|
|
759
|
+
| Mobile-first utilities | Unprefixed first, then `sm:`, `md:`, `lg:` |
|
|
760
|
+
| Touch targets | `min-h-11 min-w-11` (44px minimum) |
|
|
761
|
+
| Fluid typography | `clamp(min, preferred, max)` with `rem + vw` |
|
|
762
|
+
| Fluid spacing | `clamp()` for padding and margins |
|
|
763
|
+
| Container queries | `@container` for component responsiveness |
|
|
764
|
+
| Safe areas | `env(safe-area-inset-*)` for notched devices |
|
|
765
|
+
| Readable text | `max-w-prose` (65ch) and `leading-relaxed` |
|
|
766
|
+
| Lazy loading | `loading="lazy"` on below-fold images |
|
|
767
|
+
| Touch spacing | `gap-3` (12px) minimum between targets |
|
|
768
|
+
| Viewport meta | `width=device-width, initial-scale=1` |
|