Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:is specificity issue created after compilation #891

Open
tetz2442 opened this issue Jan 9, 2025 · 0 comments
Open

:is specificity issue created after compilation #891

tetz2442 opened this issue Jan 9, 2025 · 0 comments

Comments

@tetz2442
Copy link

tetz2442 commented Jan 9, 2025

I'm having an issue with my compiled CSS with selectors being transformed into an :is selector. The :is selector will change the specificity to match the highest in it's list. A common pattern I use is creating tag and class selectors to style my headers as shown below. This makes it easy apply different header styles to different tags that don't necessarily match.

h1,
.h1 {
  font-size: 4.4rem;

  @media (--viewport-sm) {
    font-size: 5.6rem;
  }
}

h2,
.h2 {
  font-size: 4rem;

  @media (--viewport-sm) {
    font-size: 4.4rem;
  }
}
<h2 class="h1">Title</h2>

Instead of using the styles from the .h1 selector, which should be the highest specificity, it is instead taking the styles from :is(h2, .h2), which is the compiled result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant