Skip to content
Discussion options

You must be logged in to vote

It works as expected. The utility produces the following CSS:

.not-working {
  @media (width >= 40rem) {
    color: blue;
  }
  color: red;
}

The @media at-rule does not contribute to specificity, so when the @media condition passes, it is like:

.not-working {
  color: blue;
  color: red;
}

When there are duplicate properties in a single rule, the last declaration wins. Thus, not-working will always be red, which is standard CSS behavior.

Another way to look at it is when the CSS is flattened into non-nested syntax:

@media (min-width: 40rem) {
  .not-working {
    color: #00f;
  }
}

.not-working {
  color: red;
}

Again, we can see that the color: red rule comes after the @media query. Si…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by stefanprobst
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #19246 on November 01, 2025 19:03.