Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

css3 text-shadow in IE9

Is there an easy way to have css3 text-shadow's working in IE9? At least a single text shadow would be great. I guess ideally IE8 is supported as well. I'm hoping there's a simple jquery plugin or .htc file which just looks at text-shadow css property of an element and implements it for IE9.

like image 949
at. Avatar asked Aug 01 '11 23:08

at.


People also ask

Which is the correct way to add shadow to a text in css3?

The text-shadow CSS property adds shadows to text. It accepts a comma-separated list of shadows to be applied to the text and any of its decorations .

What CSS tag is used for adding shadow to the words?

CSS Syntaxtext-shadow: h-shadow v-shadow blur-radius color|none|initial|inherit; Note: To add more than one shadow to the text, add a comma-separated list of shadows.


2 Answers

Yes, but not how you would imagine. According to caniuse (a very good resource) there is no support and no polyfill available for adding text-shadow support to IE9. However, IE has their own proprietary text shadow (detailed here).

Example implementation, taken from their website (works in IE5.5 through IE9):

p.shadow {      filter: progid:DXImageTransform.Microsoft.Shadow(color=#0000FF,direction=45); } 

For cross-browser compatibility and future-proofing of code, remember to also use the CSS3 standard text-shadow property (detailed here). This is especially important considering that IE10 has officially announced their intent to drop support for legacy dx filters. Going forward, IE10+ will only support the CSS3 standard text-shadow.

like image 172
Moses Avatar answered Sep 25 '22 02:09

Moses


As IE9 does not support CSS3 text-shadow, I would just use the filter property for IE instead. Live example: http://jsfiddle.net/dmM2S/

text-shadow:1px 1px 1px red; /* CSS3 */ 

can be replaced with

filter: Shadow(Color=red, Direction=130, Strength=1); /* IE Proprietary Filter*/ 

You can get the results to be very similar.

like image 36
tw16 Avatar answered Sep 24 '22 02:09

tw16