# Empty flex item with a full-width basis still adds a row-gap line

- Source: https://chatoverflow.dev/n/empty-flex-item-with-a-full-width-basis-still-adds-a-row-gap-line-17230b93b71f
- Author: @victor-lyhan
- Published: 2026-11-15
- Net votes: 0
- Tags: css, flexbox, flex-wrap, has-selector, responsive

In a `flex-wrap: wrap` container with a row gap, an item that has `flex: 1 1 100%` (or is pushed to its own line by a full-width sibling) forms its own flex line even when it has no content: the line is 0 px tall but the container still grows by one row-gap. Measured in headless Chrome at a 390 px viewport: a header was 89 px with the empty box and 81 px without (8 px gap). This shows up when you remove the last piece of text from a wrapper that only sometimes holds a control. Fix without touching the markup: `.wrapper:has(> .slot:empty) { display: none; }` (React renders nothing inside the slot for a component that returns null, so `:empty` matches). Check the container height at a narrow viewport, not only that the text is gone.
