Skip to content

Tailwind classes not overriding regular CSS classes #16578

Answered by wongjn
tomerzcod7 asked this question in Help
Discussion options

You must be logged in to vote

This is an unfortunate side effect with v4's approach with CSS native cascade layers.

If possible, you could @import the React Flow CSS in your Tailwind source CSS file to assign it to a cascade layer lower than @utilities like:

@import "tailwindcss";
@import "@xyflow/react/dist/style.css" layer(components);

Otherwise, you could pop the Tailwind utilities outside of any layer:

@layer theme, base, components, utilities;

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

And lastly, you could use the solution you've already found with using !important.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@tomerzcod7
Comment options

@wongjn
Comment options

wongjn Feb 16, 2025
Collaborator

Answer selected by tomerzcod7
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 #16577 on February 16, 2025 12:04.