Background opacity getting overridden by the bg-color opacity in production #6136
Replies: 2 comments 5 replies
-
Hey! Mind creating a small project that reproduces the issue? We use Next for almost all of our projects and I can’t reproduce this so need a real project to be able to troubleshoot. |
Beta Was this translation helpful? Give feedback.
-
You can try with: Generated code with .bg-white\/10 {
background-color: rgba(255, 255, 255, 0.1);
} Instead of generated code using .bg-opacity-10 {
--tw-bg-opacity: 0.1;
}
.bg-white {
--tw-bg-opacity: 1; //this Strikethrough
background-color: rgba(255, 255, 255, var(--tw-bg-opacity));
} Source from Tailwind CSS Docs if you want to learn more. This is not really a fix but a work around, But if you really want to get to the bottom of why your original approach is not working(It should). Then as @adamwathan reply says, maybe create a small reproduction of your code/project for troubleshooting. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
What version of Tailwind CSS are you using?
"^2.2.7"
What build tool (or framework if it abstracts the build tool) are you using?
Next.js 11.0.1
What version of Node.js are you using?
v12.18.3
What browser are you using?
Chrome, Safari, Firefox
What operating system are you using?
macOS
Describe your issue
The bg-opacity is not getting applied as its getting overridden by the background color's own opacity. This is the behaviour only in production. Dont know what is it that I missed.
Beta Was this translation helpful? Give feedback.
All reactions