Skip to content
FramesField
SKILL.md Developer / Local Tooling SKILL.md
Verified Nov 30, 2026

Responsive Grid and Fluid Typography CSS Skill

How to install this SKILL.md

Install into .claude/skills/, .cursor/skills/, or .agents/skills/ so your coding agent eliminates mobile horizontal overflow, cramped pricing tables, and sloppy AI-generated card grids automatically.

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.

Compatible agent hosts
Claude Code Cursor Codex
Target tool: CSS Grid / Fluid Type / Tailwind v4 · License: MIT
  1. STEP 01
    Install the Responsive Grid & Typography skill

    Pick Claude Code, Cursor, or Codex below to save SKILL.md straight from /raw/skills/.

  2. STEP 02
    Build any dashboard, editorial, or pricing layout

    Agent enforces intrinsic grids, min-w-0 overflow protection, 64ch readable copy measure, and tabular-nums.

  3. STEP 03
    Verify zero horizontal scroll at 390px

    Guarantees clean 390px mobile stacking without magic fixed widths or clipped code/table blocks.

1. Install for your tool

Pick the app you use below for the exact verified command or config—zero manual guessing.

Direct raw file (SKILL.md) ↓
Claude Code (.claude/skills/) bash
Installs into .claude/skills/responsive-grid-typography/SKILL.md for resilient responsive UI engineering.
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

2. Inspect or download the full SKILL.md file

This is the exact raw file served at /raw/skills/responsive-layout-grid-and-typography-skill.

Responsive Grid and Fluid Typography CSS Skill SKILL.md
---
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`.

3. Test it right away (sample prompt & result)

Sample prompt / input
"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."
What happens when it runs
- 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.

What you need & known limits

Requirements

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

Watch out for

  • 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

Frequently Asked Questions

Why does adding overflow-x: hidden on body hide bugs instead of fixing them?
Masking horizontal overflow on body silently clips text, buttons, and table columns off-screen on 390px phones—and also breaks position: sticky headers. Fixing the actual wide grid child with min-w-0 and wrapping tables/code in overflow-x-auto keeps every pixel accessible.
Why set mobile form inputs to text-base sm:text-sm (16px on mobile)?
iOS Safari automatically zooms the entire viewport whenever a user taps an input or select whose computed font size is below 16px, breaking responsive layouts until manually pinched out.
Use this page in AI tools or notes
raw .md