Skip to content

Drop whitespace between flex items regardless of what flanks it - #52

Open
brainkim wants to merge 1 commit into
mainfrom
flex-whitespace
Open

Drop whitespace between flex items regardless of what flanks it#52
brainkim wants to merge 1 commit into
mainfrom
flex-whitespace

Conversation

@brainkim

Copy link
Copy Markdown
Member

Whitespace-only text between flex items was kept as an anonymous item when an inline element flanked it, so it consumed gap and justify-content space. Browsers render nothing for collapsible white space between flex items (css-flexbox-1 §4) no matter what the neighboring items display as.

The fix: every element child of a flex container is a flex item of its own, inline display or not, so any element ends a whitespace text run. Only display: none children are skipped, because they generate no box. Preserved white space (white-space: pre/pre-wrap on the container) still stays an item.

Tests cover inline-flanked, block-flanked, and mixed runs.

🤖 Generated with Claude Code

https://claude.ai/code/session_01C8sSHf9EvBZroVnsXJbJSD

Whitespace-only text between flex items was kept as an anonymous item
when an inline element flanked it, so it consumed gap and
justify-content space. Every element child of a flex container is a
flex item of its own, inline display or not, so any element ends a
text run; only display: none children are skipped, because they
generate no box.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C8sSHf9EvBZroVnsXJbJSD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant