responsive-layout
Skill2 starsChanged 10 days agoMITView on GitHub
Use whenever CSS layout has to hold up on any screen, container or setting, in any language and at any length: the page breaks on phones, overflows, scrolls sideways, clips, is cramped when zoomed or stretched too wide, the headline is huge on a short or landscape screen, or someone asks to make it responsive, fluid or mobile-friendly. Covers stacks, sidebars, wrapping grids, heroes, modals, scroll strips, app shells, units, clamp, container versus media queries, long-text overflow, zoom, right-to-left, safe areas; not for page structure (layout-structure), spacing values (spacing-and-grouping) or type scales (typesetting); dialog focus semantics are out of scope.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- KyaniteLabs/tastechecktheir own version, first seen Nov 2, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- KyaniteLabs/tastecheck★ 12same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository25 other files it gives its agents.
- agent-interface-designSkill
- brand-identitySkill
- chart-designSkill
- color-paletteSkill
- data-tablesSkill
- design-critiqueSkill
- design-system-builderSkill
- form-designSkill
- generated-ui-restyleSkill
- interface-behaviorSkill
- journey-and-service-mappingSkill
- layout-structureSkill
- practice-and-assessmentSkill
- presentation-designSkill
- pricing-and-packagingSkill
- sales-conversationsSkill
- showing-workSkill
- spacing-and-groupingSkill
- teaching-interfacesSkill
- typeface-selectionSkill
- typesettingSkill
- ui-motionSkill
- ui-polish-passSkill
- user-research-basicsSkill
- visual-hierarchySkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
16 rules. About 0 are common, 12 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈12
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 29
When a neighbor named above is not installed, use ordinary judgment for that part.
- Distinctive: line 35
Only what changes the CSS: the code or markup to fix (if any), the narrowest width and the browsers or frameworks that matter, whether the …
- Distinctive: line 39
Never reply with only questions.
- Distinctive: line 43
Put the requested output first: code for a build, the fixed code for a fix, a verdict for a question.
- Distinctive: line 46
Verify instead of asserting: count the breakpoints you kept and say why each stayed, list the units you changed, and give widths you …
- Distinctive: line 66
Breakpoints: Default: as few as possible, found by resizing until the content breaks, written in em or rem so they follow the reader's text …
- Distinctive: line 68
Intrinsic pattern or query: Default: use the pattern when the change is "wrap or don't".
- Distinctive: line 70
Switching row: Default: peers sit in one row or all stack, switching together at a container width chosen for the largest expected count.
- Very specific: line 72
Grid minimum: Default: the smallest comfortable item width, capped by the container (min(16rem, 100%)).
- Distinctive: line 74
Text measure: Default: cap paragraphs and headings at roughly 60 to 70ch and leave wrappers and grids free.
- Very specific: line 76
Fixed versus fluid size: Default: relative units and min-block-size.
- Very specific: line 80
Screen-height regions: Default: min-block-size in dynamic viewport units with a plain vh line before it as a fallback.
- Distinctive: line 82
Horizontal scrolling: Default: avoid. Allow it inside a deliberate strip or a wide table wrapper that is labeled, keyboard-reachable and …
- Distinctive: line 84
Utility classes or frameworks: Default: say the technique in the user's tools.
- Very specific: line 109
No fixed height holds text.
- Distinctive: line 111
No stacking number above a small named scale.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Responsive layout
Write CSS that adapts to the space it is given, not to a list of devices. State the tolerances (the narrowest an item may get, the longest a line may run, the gap) and let the browser work out the rest. The model's default habits come from older tutorials; the fixes are small and current.
When to use
- Writing, reviewing, fixing or modernizing CSS (or utility classes) for layout: page shells, sidebars, card grids, toolbars, heroes, modals, galleries, scrollers, forms in columns.
- Complaints that something overflows, clips, scrolls sideways, is too wide on a monitor, too cramped on a phone, or breaks when text is long, large or translated.
- Choosing units,
clamp()sizes, headline or reading sizes for short, tall or distant screens, container versus media queries, or where a breakpoint belongs. - A page or component build whose layout CSS you wrote yourself and have not yet run these checks on: one last pass, silent unless it finds a failure.
The request can be one line and never say "responsive" ("it looks broken on my phone"). A short request is not a small one.
When not to use
- Deciding what structure a page needs (columns, hierarchy of regions, what is on the first screen): use layout-structure if installed. This skill codes the structure once chosen.
- Gap and padding values, grouping by proximity: use spacing-and-grouping if installed. This skill only says who owns the gap.
- Dialog semantics, focus handling, keyboard use: detailed component accessibility work, outside this skill.
- Type scale numbers and line spacing: use typesetting if installed.
- Layout tokens and their naming: use design-system-builder if installed.
- A fixed-size export (social graphic, slide, poster, print page): pixel sizes are correct. Fit the frame exactly and skip adaptive machinery.
- A trivial page (one centered message and a link): a centered flex or grid container and a readable measure is the whole job.
- Layout that already holds up. If it survives the checks below, say so and change nothing, or only what fails. Do not rewrite working CSS to show effort.
- When a neighbor named above is not installed, use ordinary judgment for that part.
A user's stack, framework, design system or stated constraint wins (a Tailwind project gets utilities, a project that must support an old browser gets that browser's fallbacks). Express the same decisions in what they use.
Inputs
Only what changes the CSS: the code or markup to fix (if any), the narrowest width and the browsers or frameworks that matter, whether the layout is fixed-format, and any reading direction beyond left to right.
- Large build in an interactive session: ask once, each item with a default ("no minimum given: 320 CSS pixels; evergreen browsers; plain CSS; left to right").
- Anything else, or no answer: deliver on the defaults and list at most three assumptions after the work.
- Never reply with only questions.
Deliver
- Put the requested output first: code for a build, the fixed code for a fix, a verdict for a question. No preamble, no restating the brief, no tour of CSS history.
- Give exactly the number of options asked for. Honor any stated length: drop the lowest-value point instead of shrinking every point.
- For a review, list problems by impact, each with the replacement code. Name what already works and leave it alone.
- Verify instead of asserting: count the breakpoints you kept and say why each stayed, list the units you changed, and give widths you reasoned about (320 CSS pixels, a narrow container, a wide one).
Procedure
Small fixes start at step 6. For a large build, write steps 1 to 4 as a short plan (regions, patterns, queries), then write one representative region in full before the rest, and continue unless the user redirects.
- Constraints from content. For each region, note the longest line allowed, the gap, the smallest comfortable width of a repeated item, and the worst content (long title, long URL, zero items, a hundred items).
- Global defaults. Border-box sizing; rem for type and most spacing,
chfor text measure, em for things that scale with the text beside them, pixels only for hairlines; images capped at their container; the root size left at the user's default. See units and fluid sizing. - One pattern per region. Match each region to the problem it has in layout patterns: content that must wrap or stack (even-spaced column, wrapping items, fitted cards, row-or-stack), a readable text width, side-by-side regions, something that must keep a shape or size (media ratio, screen-filling region), overlays, deliberate sideways scrolling.
- Choose the query, if any. First try a pattern that needs none. Then a container query for components, a media query only for viewport or device questions. See queries and breakpoints.
- Fluid sizes with bounds.
clamp()with a rem floor and ceiling for display type and big section spacing; never let the measure grow with the viewport. - Guard overflow.
min-inline-size: 0on flex and grid children that hold long content,overflow-wrap: anywherefor long strings, scrolling only inside a labeled region and only in one direction. See overflow, zoom and direction. - Overlays and stacking. Size from the viewport, scroll inside, use a small named stacking scale or the top layer.
- Direction and edges. Logical properties; safe-area insets for edge-to-edge layouts; scroll margin under sticky headers.
- Run the checks at the end of this file.
Judgment calls
Container or media query. Default: a container query for any component that appears in places of different widths (cards, tables of contents, toolbars); a media query for questions about the whole viewport or device (primary navigation pattern, hover and pointer, print, reduced motion, color scheme). Change when the component is the whole page, or the browser support you must meet lacks container queries: then use a media query with a comment saying why.
Breakpoints. Default: as few as possible, found by resizing until the content breaks, written in em or rem so they follow the reader's text size. Change when a team or system already names its breakpoints: use those.
Intrinsic pattern or query. Default: use the pattern when the change is "wrap or don't". Change to a query when the change is a different arrangement (a table becoming a list, a label moving inside a control).
Switching row. Default: peers sit in one row or all stack, switching together at a container width chosen for the largest expected count. Change when the items are really unequal in importance: use a side-by-side split or a grid.
Grid minimum. Default: the smallest comfortable item width, capped by the container (min(16rem, 100%)). Change to auto-fit when empty tracks should collapse and auto-fill when a lone item should stay card-sized, then look at one item and at three.
Text measure. Default: cap paragraphs and headings at roughly 60 to 70ch and leave wrappers and grids free. Change for code, tables and data tools, where full width is right.
Fixed versus fluid size. Default: relative units and min-block-size. Change to a fixed size for hairlines, icon boxes that must stay square, canvases, and export formats.
Display type. Default: clamp() with a rem term, a ceiling, vmin instead of vw, and a max-height guard, so a landscape phone and a short wide window both keep the headline and its call to action on screen. Change to the plain scale step when the heading sits in a fixed-width card. See type in context.
Screen-height regions. Default: min-block-size in dynamic viewport units with a plain vh line before it as a fallback. Change to a plain flow when the region holds only a short message.
Horizontal scrolling. Default: avoid. Allow it inside a deliberate strip or a wide table wrapper that is labeled, keyboard-reachable and shows a scrollbar. Change never to two directions at once.
Utility classes or frameworks. Default: say the technique in the user's tools. Change to plain CSS when no stack is stated.
Common failures (do not produce these)
- Component layout flipped by media queries at 768 and 1024 → a wrapping pattern or a container query.
minmax(300px, 1fr)overflowing a phone →minmax(min(16rem, 100%), 1fr).max-width: 800pxon the page and pixel type → achcap on text elements and rem type.height: 100vhhero clipping its button →min-block-sizewith100vhthen100dvh, and centering that can grow.- Absolute plus
translate(-50%, -50%)content spilling out → flex or grid centering. margin-bottomon every child → a parentgap, or one rule between siblings.z-index: 9999→ a named scale,isolation: isolateon components, or the dialog or popover top layer.- A long URL pushing a flex item out of its card →
min-inline-size: 0andoverflow-wrap: anywhere. - Zoom blocked with
user-scalable=noormaximum-scale=1→ remove it; reflow must work at 200%. width: 100vwcausing sideways scroll →inline-size: 100%or the container's own width.margin-leftandpadding-righteverywhere → logical properties.- A modal with a fixed width and tall content →
inline-size: min(40rem, 100% - 2rem), amax-block-size, internal scroll. - Nested scrollers fighting each other → one scroll owner per region,
overscroll-behavior: containon inner ones.
Quick checks
- At 320 CSS pixels wide there is no sideways page scroll and nothing is clipped.
- At 200% text size and with larger default text, nothing overlaps or hides.
- Paste a very long URL and a long compound word into every flex or grid child.
- A component placed in a narrow and a wide container both look right.
- Each remaining media query asks about the viewport or device, and each has a reason.
- No fixed height holds text; no
100vwwithout a reason. - Direction flipped to right to left reads correctly.
- No stacking number above a small named scale; overlays scroll inside themselves.
- Working CSS was kept and said so; the answer has exactly the number of options asked for and is within any stated length.
References
- references/layout-patterns.md: load when building or repairing regions; each pattern with a short recipe, when to use it and how it fails.
- references/units-and-fluid-sizing.md: load when setting font, spacing or container sizes, or writing
clamp(). - references/type-in-context.md: load for headline and hero sizing on short or huge screens, reading distance, margin notes, columns and the device test matrix.
- references/queries-and-breakpoints.md: load when a layout needs a query, a breakpoint, or a preference or capability check.
- references/overflow-zoom-and-direction.md: load when hardening: long strings, scroll regions, zoom and reflow, right to left, safe areas, sticky headers, stacking.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

