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

Styling direct children (*-{modifier}) issue #1934

Closed
formyjobonly opened this issue Jan 7, 2025 · 1 comment
Closed

Styling direct children (*-{modifier}) issue #1934

formyjobonly opened this issue Jan 7, 2025 · 1 comment

Comments

@formyjobonly
Copy link

formyjobonly commented Jan 7, 2025

Hi Tailwindcss Team!

Seems this statement: "It’s important to note that overriding a style with a utility directly on the child itself won’t work due to the specificity of the generated child selector." - is not correct.

It's more about order of appearence.

image

https://tailwindcss.com/docs/hover-focus-and-other-states#styling-direct-children

@philipp-spiess
Copy link
Member

Hey! The specificity of a selector using child combinators may be higher than one that doesn't, even though this is not reflected in the specificity value. You can learn more about it here:

https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity#no_value

Combinators, such as +, >, ~, " ", and ||, may make a selector more specific in what is selected but they don't add any value to the specificity weight.

So while you're right that *:… utilities will appear later in the generated stylesheet, I don't think it's necessarily wrong to call out specificity here. Thanks for the comment tho!

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

2 participants