Is there a conventional way to increase the specificity of a component's style? #28
-
I'm trying to use WA with Tailwindcss but TW seems to win specificity in corner cases (see image: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
Not really. Unfortunately this is what happens when people set global styles. Best you can do is to manually add these back. We can't control what other people set in their global styles, and the wa-divider:not([vertical]) {
border-top: solid var(--width) var(--color);
} |
Beta Was this translation helpful? Give feedback.
-
I have a feeling that using Tailwind with a component library like Web Awesome is a bit of an antipattern. As I see it, Tailwind has two key features: a token system and utility classes that make the tokens usable when defining your CSS classes in HTML. The utility classes are basically just a system for organizing one's CSS. Of course, this also combines wonderfully with Web Awesome if you like. However, the token system clashes a little with Web Awesome's design system. Web Awesome defines its own tokens (as CSS Custom Properties) for all kinds of scales, color system etc. When using Web Awesome for your own apps, I would think that you would also want to adopt its tokens in order to achieve as homogeneous a result as possible. This is where the Tailwind tokens are unfortunately not helpful. If utility classes are your cup of tea (not mine.. I'm more in favor of coffee), UnoCSS could be a good companion for Web Awesome. Maybe someone would like to create a community preset that translates Web Awesome's CSS custom properties into utility classes. |
Beta Was this translation helpful? Give feedback.
Not really. Unfortunately this is what happens when people set global styles.
Best you can do is to manually add these back. We can't control what other people set in their global styles, and the
:host
selector has lower specificity than the*
selector.