You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug description::has(> [class*='margin']) { padding: 0.1px } removes the padding of an article (and other elements) that has a no-margin child
Version: beercss 5.0.3 (still on main in src/cdn/settings/reset.css, lines 58-60)
What happens
reset.css has this rule:
:has(> [class*='margin']){padding:0.1px;}
It matches any element with a direct child whose class contains "margin", including no-margin, small-margin, top-margin, etc. Its specificity (0,1,0) is higher than article { padding: var(--_padding) } (0,0,1), so the element loses its own padding.
<articleclass="margin border round"><pclass="no-margin">A sentence that wraps over several lines in a narrow container, so its text reaches the edges of the card.</p></article>
Computed padding of the article: 0.1px instead of 1rem. The text touches the border and, with .round (2rem radius), the rounded corners cut into the text on multi-line content.
Without the no-margin class on the <p>, the article keeps its 1rem padding.
Expected
An article keeps its padding whatever the margin helper classes of its children are. If the rule exists to stop margin collapsing, it could be scoped so that it does not override the padding of components (for example :where(:not(article, .card, ...)), or a lower-specificity :where(:has(> [class*='margin']))), or use something that does not change the box, such as display: flow-root.
Hi @laurentpayot, I'd like to fix this. My plan is to narrow the selector in src/cdn/settings/reset.css so it skips no-margin children (e.g. :has(> [class*='margin']:not(.no-margin))) and keeps its specificity at or below article's padding rule, for example with :where(), so the elements keep their own padding. I'll check it against your CodePen and the other *-margin helpers. Could you assign it to me?
Activity
Mittalnew commentedon Nov 13, 2026
Hi @laurentpayot, I'd like to fix this. My plan is to narrow the selector in
src/cdn/settings/reset.cssso it skipsno-marginchildren (e.g.:has(> [class*='margin']:not(.no-margin))) and keeps its specificity at or belowarticle's padding rule, for example with:where(), so the elements keep their own padding. I'll check it against your CodePen and the other*-marginhelpers. Could you assign it to me?laurentpayot commentedon Nov 13, 2026
@Mittalnew Sure, feel free to create a PR for this 👍
fix: skip no-margin children in reset margin collapsing rule (#662)
Merge pull request #663 from Mittalnew/fix/reset-margin-no-margin-662