Skip to content

[css-cascade] [css-nesting] Figure out whether we're fine with "shifting up" bare declarations after rules #8738

Closed
@emilio

Description

@emilio

If you do:

div {
  color: green;
  @media (width > 0) {
    color: red;
    background: red;
  }
  background: green;
}

My understanding is that per spec the div color and background would be red.

That seems rather confusing. There are various alternatives here:

  • We're ok with this.
  • We forbid declarations after nested rules.
  • We deal with bare declarations by somehow sorting them together, so that would be effectively something like:
div {
  color: green;
  @media (width > 0) {
    color: red;
    background: red;
  }
  & {
    background: green
  }
}

Maybe something else?

cc @fantasai

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    unsorted FTF

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions