Kilian Valkhof

Building tools that make developers awesome.

Text-shadow in IE with jQuery

Javascript, 27 October 2008, 2 minute read

With the soon-released FireFox 3.1, three of the four major browsers support text-shadow. That leaves just Internet Explorer with the lack of text-shadow. I have already taken care of that problem, but decided to wrap it up in a nice automated jQuery plugin.

How it works

One handy little thing of Internet Explorer is that it also gives you access to CSS declarations it does not understand, so we can simply request the text-shadow value of a given element and process that. For a more in-depth explanation of how the technique itself works, please read the original article. It should work in Internet Explorer 5.5 to Internet Explorer 8, since I also added the new Internet Explorer 8 version of filter, -ms-filter.


Demo. Works only in Internet Explorer. :)

The Plugin

The plugin itself offers two functions: textShadow(); and removeTextShadow();, which do what you expect them to do.

textShadow(); Allows you to optionally overwrite the text-shadow declaration from your CSS to tweak the look of the text-shadow in Internet Explorer, if needed. The available options look like this:

	color:   "#000",
	xoffset: "5px",
	yoffset: "5px",
	radius:  "5px",
	opacity: "50"

You’ll notice that all the regular options of text-shadow are there but that I’ve also added opacity, which helps tweak the intensity of the text-shadow. It’s translates to Internet Explorer alpha-opacity, so it’s range is 0 to 100. 50 works best in most cases and is also the default.


There is really only one major limitation, it just doesn’t look as good as native text-shadow support in the other browsers. It works pretty well for average-sized text-shadows, but it falls apart on smaller or larger sizes. Tweaking it may help, but YMMV.

Another small limitation is that the padding-top and padding-left of the elements that get a shadow need to be in pixels, otherwise it won’t work. I could theoretically write something that takes care of em, %, cm, mm, pt, pc and in, but I’d really rather not.


Here you go: jquery.textshadow.js. Tested with jQuery 1.2+ but will probably work with older versions as well.

Update (26 Feb 2010)

I just released version 1.1, which fixes the problems with IE8. Have fun! In some cases you have to add a z-index to the element that you are adding a shadow to.

Polypane browser for responsive web development and design Hi, I'm Kilian. I make Polypane, the browser for responsive web development and design. If you're reading this site, that's probably interesting to you. Try it out!

  1. Hi,
    It worked .. thanks alot you have saved my time.

  2. […] Demo and Download 2、Text-shadow in IE with jQuery 在IE下轻松实现文字投影效果 Demo and Download 3、jQuery Grab Bag – Text Effects […]

  3. Cool!!! Спасибо!!! Thanks!!! Мир ВебМастера Embroidery

  4. I know it’s an older method now, but worked very well on a project I’ve just completed – thanks

  5. Very informative post. Thanks…

  6. dexter

    very curious, your demo works, but after implementing within my new project either ie7 nor ie8 will show a text-shadow!?!?!? hmm any hints?

  7. This is a great piece of information. Thank you for sharing it with us.

  8. […] filters. To deal with this problem, a Dutch front-end developer named Kilian Valkhof has written a jQuery plugin that implements text shadows in Internet […]

  9. […] problem, a Dutch front-end developer named Kilian Valkhof ( has written a jQuery plugin ( that implements text shadows in Internet […]

  10. Thanks for sharing this! I still don’t understand why IE can’t get with the program and upgrade their browser. Anytime you create anything for the wbe there must always be a “fix” for IE lol

  11. your plugin is greet
    but is not work !?

  12. Stacey

    Was excited when I stumbled upon this article. But then I found that it doesn’t work in any versions of IE that I’ve tested (using released versions on different virtual machines).

    -10 Jedi points.

  13. […] en los Texto, algo tan simple como esto, IE no lo soporta para ello Kilian Valkhof desarrolló un plugin en jQuery para que pueda ser […]

  14. […] 22. Text-shadow in IE […]

  15. […] 22. Text-shadow in IE […]

  16. […] nice text-effects without using any images. But IE does not support this feature till date. Text-shadow in IE adds this support to Internet Explorer using […]

  17. […] Text Shadow in IE with jQuery […]

  18. […] Text Shadow in IE with jQuery […]

  19. nono

    Demo does not work in IE9 or IE8 only in IE7.

  20. […] Text Shadow in IE with jQuery […]

  21. […] Text Shadow in IE with jQuery […]

  22. Amazing post. Thanks for sharing such a nice informative post.

  23. […] 17. Text-shadow in IE with jQuery […]

  24. Danny

    I’ve got this plug-in working and have figured out some of its nuances; however, I’m struggling to get it to work with a slider. Specifically, JQuery Cycle. In this case in Drupal as Views Slideshow.

    The effect only displays on the first slide. I’ve tested a few other JQuery functions to make sure this isn’t a JQuery issue and it’s not. I’ve also tried manually declaring the options with no luck either.

    Any suggestions for me?

    Your plug-in seems to be the most viable comparative to what else is out there. The elements that I CAN get it to work on look great!


  25. Awesome jQuery plugin! It creates a great typography effects when combined with Google Fonts API. It fits perfectly for my current project.

    Thank you for sharing.

  26. […] would have thought they’d be using a script like this one or this one, or even the Microsoft-only shadow filter. While those are options to consider, […]

  27. Works fine on all my browsers. So helpful post that I never found it on the net before.

  28. […] nice text-effects without using any images. But IE does not support this feature till date. Text-shadow in IE adds this support to Internet Explorer using […]

  29. MiB

    This doesn’t work in IE9 which makes it useless. Neal Grosskopf tecnique does work.

  30. Here is an example that works with jQuery 1.8.1!

    Your shadow can also be set as:
    $(document).ready(function() {
    $(‘h1’).css(‘text-shadow’, ‘1px 1px #fff’).textShadow();

    In your script, you need to replace:
    var shadowarray = obj.css(“text-shadow”).split(” “);
    var sradi = parseInt(shadowarray[3], 10);
    var text = “” + obj.html() + “”;

    var padding = {
    left:parseInt(obj.css(“padding-left”), 10),
    top:parseInt(obj.css(“padding-top”), 10)

    var defaults = {
    color: shadowarray[0],
    radius: sradi,
    xoffset: parseInt(shadowarray[1], 10)-1+(padding.left-sradi) + “px”,
    yoffset: parseInt(shadowarray[2], 10)-1+( + “px”,
    opacity: 50

    var defSettings = obj.css(‘text-shadow’).split(‘ ‘);
    var text = “{ ” + obj.html() + ” }”;
    var defaults = {
    color: defSettings[2],
    xoffset: defSettings[0],
    yoffset: defSettings[1],
    radius: “0px”,
    opacity: “100”

  31. […] Text-shadow in IE with jQuery […]

  32. […] 21. Text-shadow in IE with jQuery […]

  33. balam

    Can be applied to png image with transparency background??