fix: prevent margin collapse between consecutive cell outputs#8215
Merged
mscolnick merged 1 commit intomarimo-team:mainfrom Feb 10, 2026
Merged
Conversation
In run mode, consecutive markdown cell outputs have slightly less vertical spacing than content within a single markdown cell. This happens because CSS margin collapsing merges the bottom margin of one cell output with the top margin of the next. Wrapping rendered cells in a flex column container prevents margin collapse, ensuring the full 1rem + 1rem spacing between adjacent cell outputs is preserved. The explicit gap-5 for the "show code" variant is conditionally applied on the same container. Fixes marimo-team#3063
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes inconsistent vertical spacing between consecutive markdown cell outputs by preventing CSS margin collapsing in the vertical layout renderer.
Changes:
- Always wrap rendered cells in a
flex flex-colcontainer to prevent margin collapsing between sibling outputs. - Keep the existing inter-cell
gap-5spacing behavior when code is shown (conditional onshowCode && canShowCode).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
mscolnick
approved these changes
Feb 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Consecutive markdown cell outputs had less vertical spacing than content within a single cell due to CSS margin collapsing. Wrapping the output container in
flex flex-colprevents margin collapsing between siblings.Closes #3063
Test Plan
mo.md()cells now have consistent spacing