Skip to content

Keep article padding when a child has no-margin (fix #662) - #663

Merged
leonardorafael merged 2 commits into
beercss:devfrom
Mittalnew:fix/reset-margin-no-margin-662
Nov 27, 2026
Merged

leonardorafael merged 2 commits into
beercss:devfrom
Mittalnew:fix/reset-margin-no-margin-662

Conversation

@Mittalnew

Copy link
Copy Markdown

:has(> [class*='margin']) { padding: 0.1px } in src/cdn/settings/reset.css also matched no-margin children. Its specificity (0,1,0) beat article { padding: var(--_padding) } (0,0,1), so a card with a no-margin child lost its padding and .round corners clipped the text.

The selector is now :where(:has(> [class*='margin']:not(.no-margin))). It skips no-margin children, and :where() keeps specificity at (0,0,0) so article / other components keep their own padding for other *-margin helpers too. The 0.1px margin-collapse guard still applies to parents that have no padding of their own.

Verified against the CodePen in the issue, plus small-margin and top-margin children. npm run test passed (209 tests). Dist was not committed, per CONTRIBUTING.

before-
beforePadding

after -
afterPadding

Fixes #662

@leonardorafael leonardorafael left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@leonardorafael
leonardorafael merged commit 408b2df into beercss:dev Nov 27, 2026
leonardorafael added a commit that referenced this pull request Nov 27, 2026
…rgin-662"

This reverts commit 408b2df, reversing
changes made to 7c4201c.
@Mittalnew

Copy link
Copy Markdown
Author

Yaaaa huuuu , Thanks for the review and merge, @leonardorafael! Happy to help with more BeerCSS issues.

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.

2 participants