/* Standard viewport units - problematic on mobile */
.full-height { height: 100vh; }
/* Dynamic viewport units (recommended) */
.full-height-dynamic { height: 100dvh; } /* Accounts for mobile browser UI */
/* Small viewport (minimum when UI shown) */
.min-full-height { min-height: 100svh; }
/* Large viewport (maximum when UI hidden) */
.max-full-height { max-height: 100lvh; }
Best Practices
1. Mobile-First: Write base styles for mobile, enhance for larger screens
2. Content Breakpoints: Set breakpoints where content breaks, not device sizes
3. Fluid Over Fixed: Prefer clamp() and relative units over fixed px
4. Container Queries: Use for component-level responsiveness
5. Touch Targets: Minimum 44Γ44px tap targets on mobile
6. Test Real Devices: Simulators don't catch all issues
7. Logical Properties: Use inline/block for internationalization
Common Issues
| Issue | Cause | Fix |
|-------|-------|-----|
| Horizontal scroll | Fixed widths | Use relative units, max-width: 100% |
| 100vh too tall on mobile | Address bar | Use 100dvh or 100svh |
| Tiny tap targets | Desktop design | Min 44px height/width on interactive elements |
| Images breaking layout | Missing constraints | Add max-width: 100%; height: auto; |
| Text too small | Fixed font size | Use fluid typography with clamp() |
NEVER
Use px for typography (use rem)
Skip mobile testing on real devices
Forget touch target sizing (44Γ44px minimum)
Use 100vh on mobile without fallback
Nest too many media queries (flattens readability)
Ignore content-based breakpoints in favor of device-specific ones
π Tips & Best Practices
1. Mobile-First: Write base styles for mobile, enhance for larger screens
2. Content Breakpoints: Set breakpoints where content breaks, not device sizes
3. Fluid Over Fixed: Prefer clamp() and relative units over fixed px
4. Container Queries: Use for component-level responsiveness
5. Touch Targets: Minimum 44Γ44px tap targets on mobile
6. Test Real Devices: Simulators don't catch all issues
7. Logical Properties: Use inline/block for internationalization