bg-opacity-<value> doesn't work with arbitrary values
See original GitHub issueHi,
I want to use CSS variables with bg-
and found that it doesn’t generate the style to adjust the background opacity.
Here’s playground link
--un-bg-opacity: 1;
style is only generated for static class bg-red
and not for bg-$c
& bg-[red]
.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
tailwind css - Focus ring opacity not working with arbitrary value
In your first example: <input type="text" className="focus:ring focus:ring-[rgba(0, 244, 0)]" />. I expect your arbitrary value is being ...
Read more >Using arbitrary color as rgba() · Discussion #6551 - GitHub
If I do something like bg-[#f03232] , it correctly registers the background color as such, but I'm unable to do the same with...
Read more >Background Color - Tailwind CSS
Control the opacity of an element's background color using the color opacity modifier. ... You can use any value defined in your opacity...
Read more >Tailwind CSS Background Opacity - GeeksforGeeks
This class accepts lots of value in tailwind CSS in which all the properties are covered in class form. The bg-opacity is the...
Read more >How to apply arbitrary styles with tailwind JIT - Educative.io
Unlike component frameworks or libraries, Tailwind doesn't restrict you to preexisting components ... height, and background color using Arbitrary values:
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
As I understand,
util-$value
andutil-[value]
generally use the intendedvalue
as is, so usually there are no processing involved.For now, you have to add them separately. The rationale is that
--x
invar(--x)
can contain#f00
,red
,255, 0, 0
,rgb(255, 0, 0)
or even any other string.Another thing you can do maybe is to add custom shortcut
Mostly tailwind syntax works:
variant:util
,[prop:value]
andcolor-util:opacity
In bracket, CSS color values are not resolved from theme or keywords. For the keyword part, you may want to add the list of values to the preset.