8000 [css-nesting] wording `&&` "silly", but useful · Issue #9113 · w3c/csswg-drafts · GitHub
[go: up one dir, main page]

Skip to content

[css-nesting] wording && "silly", but useful #9113

@tobymackenzie

Description

@tobymackenzie

Not sure if this is the place to bring this up, but: In the CSS Nesting spec example 5, there is an example showing a nested &&, describing it as "Again, silly, but can even be doubled up." The unnested equivalent of that example is:

.foo { color: blue; }
.foo.foo { padding: 2ch; }

It seems less silly when considering that the .foo.foo has double the specificity (0-2-0) of the .foo selector (0-1-0). That is a somewhat common technique of increasing specificity without changing anything of the "query" of the selector. Being able to chain the & in a nested selector makes it less verbose and easier to manage this technique, and it might be worth noting this to make it more apparent, or at least dropping the "silly" bit.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0