---
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://framesfield.com/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
title: "Responsive Grid and Fluid Typography CSS Skill"
description: "Installable SKILL.md teaching Claude Code, Cursor, and Codex to build zero-overflow responsive layouts (390px mobile to 1440px desktop) using intrinsic CSS Grid, container queries, clamp() fluid type scales, 60-68ch prose measure limits, tabular-nums data columns, and safe min-w-0 flex/grid children."
canonical: "https://framesfield.com/skills/responsive-layout-grid-and-typography-skill"
---

# Responsive Grid and Fluid Typography CSS Skill

> Installable SKILL.md teaching Claude Code, Cursor, and Codex to build zero-overflow responsive layouts (390px mobile to 1440px desktop) using intrinsic CSS Grid, container queries, clamp() fluid type scales, 60-68ch prose measure limits, tabular-nums data columns, and safe min-w-0 flex/grid children.

- **Canonical URL:** https://framesfield.com/skills/responsive-layout-grid-and-typography-skill
- **Raw Payload URL:** https://framesfield.com/raw/skills/responsive-layout-grid-and-typography-skill
- **Asset Type:** SKILL.md
- **Compatible Hosts:** Claude Code, Cursor, Codex
- **Target Creative Tool:** CSS Grid / Fluid Type / Tailwind v4
- **License:** MIT
- **Last Verified:** 2026-11-30
- **Source Reference:** https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_grid_layout

## Setup & Install

```bash
mkdir -p .claude/skills/responsive-grid-typography
curl -fsSL https://framesfield.com/raw/skills/responsive-layout-grid-and-typography-skill -o .claude/skills/responsive-grid-typography/SKILL.md

```

## Copyable Asset (SKILL.md)

```markdown
---
name: responsive-grid-typography
description: Build resilient responsive web layouts from 390px mobile to 1440px+ desktop using intrinsic CSS Grid, min-w-0 flex/grid overflow guards, fluid clamp() headings, 60-68ch body measure limits, tabular-nums numeric alignment, and safe mobile table/code scrolling.
---

# Responsive Layout Grid & Fluid Editorial Typography Protocol

Whenever implementing page sections, pricing matrices, documentation layouts, or editorial cards in Astro, React, or Tailwind CSS v4, strictly apply these layout and typographic engineering standards:

## 1. Zero Mobile Horizontal Overflow (`390px` Guarantee)
The top #1 bug in AI-generated frontends is accidental horizontal scrolling on `375px–390px` viewports. Prevent it structurally:
- **Add `min-w-0` on flex and grid columns** that contain `<pre>`, `<code>`, URLs, or long titles (`min-width: auto` is CSS's default and lets children blow past grid tracks).
- **Wrap every `<table>` in a horizontal scroll container:** `<div class="w-full overflow-x-auto"><table class="w-full ...">` with `whitespace-nowrap` strictly on compact numeric cells—never on long narrative descriptions.
- **Never hardcode wide fixed pixel widths** (`w-[520px]`); use `w-full max-w-[520px]` or intrinsic grids (`grid-cols-[repeat(auto-fit,minmax(min(100%,280px),1fr))]`).
- **Keep `<pre>` code boxes self-scrolling:** Always apply `max-w-full overflow-x-auto` to code blocks so long shell commands scroll inside the box instead of pushing the page body wide.

## 2. Typographic Measure, Scale & Alignment Discipline
- **Reading measure (`ch`):** Cap body paragraphs and editorial prose at **`max-w-[64ch]` to `max-w-[68ch]`** (never let 16px sentences stretch 1,200 pixels across a widescreen monitor).
- **Fluid headings (`clamp()`):** Scale display headings smoothly across viewports (e.g., `clamp(1.85rem, 1.3rem + 2.2vw, 3.25rem)`) with tight optical tracking (`-0.025em` to `-0.03em`) and balanced wrapping (`text-wrap: balance`).
- **Tabular figures (`font-variant-numeric: tabular-nums`):** Always apply `tabular-nums` on pricing columns, unit rates (`$0.04`), index codes (`01`..`45`), timestamps, and comparison metrics so digits align vertically.
- **Mobile input zoom guard:** Keep `<input>`, `<select>`, and `<textarea>` font sizes at `>= 16px` (`text-base sm:text-sm`) on touch viewports so iOS Safari never auto-zooms awkwardly on focus.

## 3. Touch Target & Spacing Rhythm
- Maintain a consistent `4px / 8px` spatial scale (`gap-3`, `gap-4`, `gap-6`, `p-5 sm:p-6`); avoid odd magic gaps (`gap-[19px]`).
- Ensure buttons, filter chips, and nav links maintain a comfortable `>= 40–44px` hit height on mobile viewports.

## 4. Verification Assertion
After rendering any new section, verify at both `1440x900` and `390x844` (via Playwright MCP `Skill 26`):
`document.documentElement.scrollWidth <= window.innerWidth` MUST evaluate `true`.
```

## Example Input

```text
"Fix our responsive comparison grid and pricing table in PricingSection.astro so it stacks cleanly at 390px without horizontal overflow and aligns all dollar columns vertically."
```

## Expected Output

```text
- Adds min-w-0 to grid items, wraps the pricing matrix in overflow-x-auto, switches fixed widths to w-full max-w-*, and applies tabular-nums to every price cell.
- Sets readable max-w-[66ch] lead measure and verifies scrollWidth <= innerWidth at 390x844 and 1440x900.
```

## Requirements

- Modern CSS / Tailwind CSS v4 (Astro, React, Next.js, Vue, or Svelte)
- Optional Playwright MCP (`Skill 26`) to assert `scrollWidth <= innerWidth` automatically

## Known Limits

- Use CSS `text-wrap: balance` on short headings (`h1`/`h2`), not multi-sentence body paragraphs
- Never suppress overflow globally with `body { overflow-x: hidden }` to hide broken wide children—fix the offending child with `min-w-0` or `overflow-x-auto`

## Implementation Notes

## Pair with semantic tokens and automated UI critique

Combine directly with [Skill 32: CSS Design Tokens and Tailwind v4 Theme Skill](/skills/design-tokens-tailwind-v4-skill), [Skill 35: UI Design Critic and Accessibility Subagent](/skills/ui-design-critic-and-a11y-agent), and [Guide 10: AI Design-to-Code: Figma MCP, Tokens and Visual QA](/guides/design-to-code-ai-engineering-guide).
