Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tailwind CSS how to apply background opacity to gradient background?

I'm trying to create a background effect that is based on the types of a Pokemon. The way I'm trying to implement this is by creating a linear gradient background and applying opacity to it. I'm using Tailwind CSS but the opacity is not applying. (I believe this is because lin-grad has no opacity property.)

The specific tailwind CSS code snippet I'm using is below, where grass and poison are colors. Is it possible to apply opacity to a linear gradient background?

"bg-gradient-to-r from-grass to-poison bg-opacity-20"

enter image description here

like image 338
Adam Lau Avatar asked Oct 26 '25 05:10

Adam Lau


1 Answers

Trying out the latest Tailwind v3.0 features, now you can make a gradient color slightly see-through by adding /20. In your situation, give this a shot:

"bg-gradient-to-r from-grass/20 to-poison/20"
like image 67
Tharaka Sandaruwan Avatar answered Oct 28 '25 19:10

Tharaka Sandaruwan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!