Code Snippet
CSS Text Shadow
Regular text shadow:
p { text-shadow: 1px 1px 1px #000; }Multiple shadows:
p { text-shadow: 1px 1px 1px #000, 3px 3px 5px blue; }The first two values specify the length of the shadow offset. The first value specifies the horizontal distance and the second specifies the vertical distance of the shadow. The third value specifies the blur radius and the last value describes the color of the shadow:
1. value = The X-coordinate
2. value = The Y-coordinate
3. value = The blur radius
4. value = The color of the shadow
Using positive numbers as the first two values ends up with placing the shadow to the right of the text horizontally (first value) and placing the shadow below the text vertically (second value).
The third value, the blur radius, is an optional value which can be specified but don’t have to. It’s the amount of pixels the text is stretched which causes a blur effect. If you don’t use the third value it is treated as if you specified a blur radius of zero.
Also, remember you can use RGBA values for the color, for example, a 40% transparency of white:
p { text-shadow: 0px 2px 2px rgba(255, 255, 255, 0.4); }
For ‘shadow’ use black eg: rgba(0, 0, 0, 0.4);
i wish i had coda.. (i have windows)
The Coda clips addition is a great feature Chris. Thanks.
Love the coda snippet feature. Very nifty.
Great job Chris! Loving the Coda addition.
Oooh! Nice. And lovin’ Coda even more.
Thanks!
AWESOME! Yet another great feature to the site!
Just another great reason why Textmate owns.
Why doesn’t Firefox support CSS text shadows? Is there a workaround for FF?
Firefox latest does support it.
You may have to use -mozilla-text-shadow. (Not sure though.)
For firefox, just add a copy of those lines and replace “text-shadow” with “-moz-text-shadow”.
Is there a way to be able to achieve this effect while still having valid CSS(2.1, I know it’s valid in CSS3, but I need it for CSS2.1 as well).
nope -moz-text-shadow doesn’t work
When using multiple shadows… are they rendered in the order they are listed? For example, if I have a 1px shadow could I accidentally cover it with a 3px shadow because I listed them in my CSS in reverse order?
isnt there any other way of using colours in the website codes without typing the color codes. e,g using the name of the colour like red instead of something like this #FFFFF
Scott, you can use names of colors. Just use the name of the color in place of the hex value. The color “blue” is even used in this text-shadow example.
You can find a list of supported CSS color names here:
http://en.wikipedia.org/wiki/Web_colors
Grazie per l’articolo, non puoi immaginare quanto mi sia stato d’aiuto!
Complimenti per il sito!
Hello
Be aware that setting css3 text-shadow will affect the anti-aliasing in google chrome on windows.
Make a try if you are using Microsoft windows and you will see that in chrome fonts are ugly if you use css3 text-shadow.
check the bug report in the Google chrome help forum”.
And by the way, thanks Chris for sharing your knowledge.
Great!!!
But it is not a valid property……
This is nice to know. I have used it once or twice now.
Finally! I find a straight forward way to use drop shadow with css. I’m a newbie so I appreciate your post. Thank you
props on the fools and horses reference :)
Thanks for this Nice thread ;)
I’m playing with it but I’m little confused about inner shadow!
Is it possible or any way to use inner-shadow?
Nice Tutorial!, The text-shadow property really rocks.