Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Text shadow opacity

Tags:

css

opacity

Is it possible to adjust the opacity of just the text shadow, rather than the text itself as well?

E.g I have purple text with a blue shadow. I'd like to make the blue shadow have an opacity without losing anything on the purple.

h1.blue {text-shadow: 3px 3px 0px #3f6ba9;}
like image 569
Francesca Avatar asked Jul 18 '12 20:07

Francesca


2 Answers

Yes, but specify color in rgba mode to add alpha transparency.

h1.blue {text-shadow: 3px 3px 0px rgba(63,107,169, 0.5)} //half of transparency 
like image 67
Grzegorz Kaczan Avatar answered Oct 16 '22 10:10

Grzegorz Kaczan


To add on the answer for anyone looking to use HEX code instead of RGB:

h1.blue {text-shadow: 3px 3px 0px #3f6ba980;}

The last 2 characters in the above HEX code has opacity set at 50%. For other opacity values, please refer to opacity-hex charts as linked here. Alternatively, if you are using VScode, you will be able to use their in-built color picker to adjust the opacity.

like image 33
Goh Jia Yi Avatar answered Oct 16 '22 10:10

Goh Jia Yi