Skip to content

How to deal with the issue with WordPress styles and Tailwind's layered styles (weaker)? #16882

Answered by wongjn
kostiantyn-petlia asked this question in Help
Discussion options

You must be logged in to vote

You could consider unwrapping some of the styles from the @layers, like:

-@import "tailwindcss";
+@layer theme, base, components;
+
+@import "tailwindcss/theme.css" layer(theme);
+@import "tailwindcss/preflight.css" layer(base);
+@import "tailwindcss/utilities.css";

And if you still need more specificity (probably for utility classes, you could do something like):

@layer theme, base, components;

@import "tailwindcss/theme.css" layer(theme);
@import "tailwindcss/preflight.css" layer(base);

/**
 * The `*` will match anything, but the `#a` increases specificity.
 * You could replace this for an actual ID selector too, or perhaps
 * a class selector would be sufficient.
 */
:is(#a, *) {
  @…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by kostiantyn-petlia
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
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