Skip to content

Clarify CSS nesting concatenation section#44303

Open
vamshikrishnaramasamy wants to merge 1 commit into
mdn:mainfrom
vamshikrishnaramasamy:docs/issue-44186-nesting-concatenation
Open

Clarify CSS nesting concatenation section#44303
vamshikrishnaramasamy wants to merge 1 commit into
mdn:mainfrom
vamshikrishnaramasamy:docs/issue-44186-nesting-concatenation

Conversation

@vamshikrishnaramasamy
Copy link
Copy Markdown
Contributor

Fixes #44186.

The Concatenation section on the Using CSS nesting page mixed the Sass input and Sass output in one example-bad block and never showed what a browser actually does with &__child-element in real CSS nesting. This reworks it to:

  • Drop the parenthetical from the heading (Concatenation (is not possible)Concatenation is not possible).
  • Show the Sass rule and the class it compiles to as plain, valid Sass (no longer mislabeled example-bad).
  • Add a separate example-bad CSS-nesting block making it explicit that the browser ignores the invalid nested rule.
  • Tighten the explanation: the __child-element type selector ends up after the nesting selector, which is invalid, so the nested rule is discarded while the surrounding .component rule is unaffected.

I confirmed the behavior in Chrome via the CSSOM: with &__child-element, the nested rule is dropped from the stylesheet entirely and only .component remains; element& parses as a valid compound selector. This matches the existing claim on the page — the change is purely for clarity, not a behavioral correction.

Separate the Sass input/output from the CSS-nesting result, add an
explicit example showing the browser ignores the invalid nested rule,
and tighten the explanation of why the type selector must come first.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vamshikrishnaramasamy vamshikrishnaramasamy requested a review from a team as a code owner May 30, 2026 02:18
@vamshikrishnaramasamy vamshikrishnaramasamy requested review from hamishwillee and removed request for a team May 30, 2026 02:18
@github-actions github-actions Bot added Content:CSS Cascading Style Sheets docs size/s [PR only] 6-50 LoC changed labels May 30, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Preview URLs (1 page)

External URLs (2)

URL: /en-US/docs/Web/CSS/Guides/Nesting/Using
Title: Using CSS nesting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:CSS Cascading Style Sheets docs size/s [PR only] 6-50 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Text on nesting concatenation is not immediately clear

2 participants