css-layout-debugging · git:20261120.76a1b83 · 2026-11-20 · sha256 541094cb392e22b8

css-layout-debugging git:20261120.76a1b83A

Immutable. This exact content never changes and is served at /api/v1/blob/541094cb392e22b8.

No tool to install first
claude plugin marketplace add https://markdownregistry.com/mp/a/art_ydzw35a3dnphazpc/541094cb392e22b8c42bf64d73d36c41df8c1c58acfc7c7036f541b2b8d76fe1.json

Then /plugin install css-layout-debugging@markdownregistry-ydzw35a3dnphazpc in Claude Code. It installs this exact version, the one graded A here, pinned to the commit it was graded at, and leaves it there.

---
name: css-layout-debugging
description: Diagnoses broken flexbox and grid layouts by inspecting the box model and computed styles, then fixes the root rule instead of piling on overrides.
---

# CSS layout debugging

Find the rule that causes the problem. Do not stack `!important` on top of it.

## Steps

1. Pin down the failure: the element, the viewport width, the expected layout versus the actual layout. If a dev server and browser tools exist, load the page at that width and take a screenshot.
2. Walk up from the broken element to the root. For each ancestor read the computed `display`, `position`, `width`, `height`, `min-*`, `max-*`, `overflow`, `margin`, `padding`, `box-sizing`, `flex`, `grid-template-*`, `gap` and `transform`. Use `getComputedStyle` through the browser console when you can.
3. Check the usual causes in order:
   - Flex items default to `min-width: auto`, so long text or images stop them shrinking; the fix is `min-width: 0` on the item.
   - Percentage heights need a parent with a definite height.
   - `overflow` other than visible on an ancestor breaks `position: sticky`.
   - Margins collapse between block siblings and parent and child.
   - `align-items: stretch` and `auto` margins fight each other.
   - A grid track sized with `1fr` has the same min-content trap; use `minmax(0, 1fr)`.
4. Change one property at a time, in the browser first, then in the source file that owns the rule.
5. Recheck at the failing width and at one narrower and one wider width.

## Rules

- Fix the owning rule; never patch with fixed pixel widths, magic margins or `!important`.
- Do not restructure the markup unless the cause is in it.

## Report

Cause in one sentence, the property and file changed, and the widths you rechecked.