22nd of June 2010 0
Have you seen all those nifty text-shadow on so called 'web 2.0' sites and been baffled that there seem to be no simple solution available in order to get it cross browser and working in IE6-IE8?

I've searched high and low for a simple solution but in the end decided to create my own via jQuery since there wasn't any good and light weight solutions at all as usual.
The solution is to duplicate text and inject em (or span tags if you'd like) into the tags and classes of your choosing and then to, via css, position it.
So let's begin with the jQuery:
$(function () {
var textshadow = $("p.textshadow"); //replace with your own!
textshadow.append("<em></em> ");
textshadow.each(function() { var dupeText = $(this).text(); $(this).find("em").text(dupeText); });
}); //end domready
What this jQuery code does is that it simply looks for the selectors you choose (var textshadow), injects em-tags and later on copies the original text and appends it within an em-tag. You could also use a span-tag if you're worried about semantics, just replace the stuff within the script and later on within the CSS.
And say hello to the CSS:
p.textshadow {
position:relative;
zoom:1; /* Enable layout in IE */
color:#fff; /* Color of shadow? */
z-index:9;
}p.textshadow em {
position:absolute;
top:-1px;
left:-1px;
z-index:10;
color:#444; /* Color of the text? */
font-style:normal; /* Only if you want to remove default styling of the EM-tag */
}
Ok -- So what does all this do? First we say that p.textshadow should be positioned relative so that we later on can adjust the em-tag absolutely within the P-tag. Next we continue to use zoom:1 in order to give the P-tag layout in our beloved friend Internet Explorer and fix some box model issues. We then apply the color we want for the shadow, in this case #fff (white). Then we set a default z-index for the main P-tag; z-index:10.
In order for all this to work smoothly we need to re-define our base color for the P-tag as well and we continue doing that within the EM-tag, color #444 in the example.
Important to note here is the switching. You need to define your main color for the selected tag within the new CSS. You'll also, of course, need to load jQuery before anything of this work. If you are still uncertain of anything just check out the example.
Note also that you should absolutely not use this for body text, just for a couple of elements like certain headers or similar. It's certainly also advisable to use this with conditional comments for Internet Explorer and for the rest use CSS3's text-shadow property.
If you know a way to further optimize this code feel free to share it! I am by no means an expert with jQuery or won't ever be either probably.
Filed under § Jquery — Tagged with ".textshadow is not a function", "cufon-loading css", "internet explorer 9" " tag", "internet explorer" disabled css button schatten, "jquery.textshadow" ie8 fix, "text shadow" script, .hide() ext.shadow example, .load jquery flicker, a tag text shadow in ie8, add color cufon slow internet explorer, add text shadow by jquery, amino acids, apply text shadow in i7, background flicker ie7 textshadow, best jquery shadow script, best text shadow internet explorer, best textshadow jquery, blog text shadow ie, box shadow ie8 fix, box shadow jquery, box shadow script, box-shadow ie jquery, box-shadow jquery ie7 ie8, boxshadow ie8, browser tab index jquery, button disabled embossed css "text-shadow", button drop shadow jquery, button flach shadow, button with shadow crossbrowser, button with shadow example, byme.se, carbodec tr, change jquery error positions on p tag, clomifene, cool cross browser jquery buttons, corss broswer jquery text-shadow, create a text shadow web2.0, create css text shadow in internet explorer, create dop text shadow plugin for ie, cross browser css text shadow, cross browser double text, cross browser drop shadow button, cross browser drop shadow script, cross browser jquery html elements disabled, cross browser jquery position absolute, cross browser jquery scripts, cross browser jquery shadows, cross browser jquery tabs, cross browser jquery text dropshadow, cross browser menu shadow examples & code, cross browser position relative text shadow, cross browser shadow text html code, cross browser shadow text jquery, cross browser show hide function in ie 8, cross browser text drop shadow jquery, cross browser text shadow, cross browser text shadow css, cross browser text shadow cufon, cross browser text shadow jquery, cross browser text shadow jquery plugin, cross browser text-shadow css3, cross browser textshadow, cross browsing jquery shadow text plugin, crossbrowser ie7 ie8 ie6 hack css, crossbrowser jquery, crossbrowser text effects without scripts, crossbrowser text schadow#sclient=psy, crossbrowser text-shadow jquery, crossbrowser textshadow jquery, crosss browser text shadow, CSS, css 3 drop shadows on ie8, css cross-browser text shadow, css disable button ie double, css disabled button text shadow ie, css div shadow web 2.0, css double text shadow, css drop shadow on font jquerymobile, css jquery cross browser text shadow, css remove white text shadow from disabled button, css shadow crossbrowser jquery, css shadow cufon, css shadow explorer jquery, css shadow ie, css shadow web2.0, css simple web 2.0 shadow, css tekst shadow e, css text cross browser shadow, css text drop shadow working with ie8 & ie7, css text shadow all ie, css text shadow cross browser, css text shadow cross browser jquery, css text shadow cross-browsing, css text shadow fix, css text shadow fix for e, css text shadow fix ie7, css text shadow ie, css text shadow ie fix, css text shadow ie jquery, css text shadow ie6, css text shadow ie9, css text shadow jquery, css text shadow not displaying in ie, css text shadow not working in jquery feature list script, css text shadows not showing on ie 8, css text-shadow disable, css text-shadow ie8, css text-shadow jquery get, css text-shadow web 2.0, css text-shadow workaround, css web 2 0 text shadow, css3 box shadow with juery, css3 button shadow examples, css3 cross browser text shadow, css3 crossbrowser script, css3 ie 8 workarounds, css3 internet explorer jquery, css3 multiple elements text-shadow jquery, css3 text design example, css3 text shadow hide, css3 text shadow ie7, css3 text shadow in jquery script, css3 text-shadow cross browser jquery, css3 text-shadow ie jquery textshadow();., css3 text-shadow internet explorer 8, css3 text-shadow jquery ie9, css3 textshadows ie7, cufon and css text shadow, cufon and css3 shadows, cufon and css3 text shadow, cufon cross browser shadow, cufon css shadow, cufon css3 text-shadow, cufon disable text shadow, cufon double shadow, cufon double text, cufon doubling text, cufon drop shadow, cufon drop shadow ie, cufon embossed text, cufon flackern in ie9, cufon fonts text-shadow in magento, cufon ie position, cufon ie text-shadow, cufon ie8 4 shadows, cufon jquery ie9, cufon loading hide, cufon remove double strike, cufon remove textshadow, cufon shadow browser, cufon shadow ie7, cufon shadow in ie7, cufon shadow text all browsers, cufon shadows in different browsers, cufon text shadow, cufon text shadow css, cufon text shadow ie, cufon text shadow ie7, cufon text shadow in ie7, cufon text shadow is not working, cufon text shadow property, cufon text shadow white, cufon text twi, cufon text with drop shadow, cufon text-shadow ie problems, cufon text-shadow ie6, cufon textshadow, cufon textshadow ie, cufon textshadow ie script error, cufon и css3, cufon-loading, cufon-loading internet explorer, cufontext problem with internet explorer 9, define text shadow ie, disable cufon in ie7, disable cufon on ie7, disable ie shadow with jquery, disable shadow ie6, disable shadows jquery mobile, disable text shadow ie7, disable text shadows in ie, disable text-shadow css, disable text-shadow css on ie, disable text-shadow ie, disable text-shadow in ie only, disabled buttons text shadow, disabled css text shadow, disabled showdow on regular text ie, disabled tag white shadow remove ie, div tag shows shadow in ie6 when disabled, domready jquery shadow text, double text ie disabled, download audaco, drop shadow jquery plugin ie 8, drop shadow on cufon text, drop shadows ie9, dropshadow jquery cufon, duplicate text jquery, embossed css, erro no ie font text shadow, example, example text-shadow jquery, explorer 7 shadow, explorer 7 text-shadow, explorer 9 text shadow, explorer text shadow, firefox addon bookmark anywhere, fix css shadow with jquery, fix ie text shadow, fix text shadow in ie, fix text-shadow ie6, fixed css shadow, fixing ie9 z-index issue using simple jquery solution, flatulex, flickering drop shadow ie 9, full cross browser text shadow by jquery, full shadow jquery, function text-shadow, get rid of jquery mobile text shadow, good textshadow ie9, hack for text-shadows in ie9, hide show jquery cross browser, hide text shadow, how can we define ie6 button text, how to apply drop shadow to a button in ie7, how to define cross browser css, how to define text shadow in cufon, how to define text shadow in html, how to disable cufon textshadow ie, how to disable drop shadow in ie, how to disable shadowing in ie exolorer, how to display css3 text shadow in ie7, how to insert text in mage with jquery, how to remove disabled button text shadow in ie8, how to support cufon in ie7 browsers, how to text shadow css i6, how to use cufon in html for drop shadow, how we define text shadwo, how we use text shadow in cufon, html css shadow cross browser, html disable text shadow, html text shadow, html text shadow and ie8, html text shadow script, html text-shadow cross-browser, i7 text shadow, ie, ie 7 shadows cufon, ie 8 jquery text drop shadow, ie 9 text-shadow, ie best solution for text shadow, ie css text shadow jquery, ie css3 script shadow, ie disabled button text shadow, ie disabled jquery css, ie disabled shadow button, ie double text button, ie double text disabled, ie drop full shadow, ie filter shadow, ie fix shadow, ie remove shadow of disabled button text, ie shadow script, ie shadow zoom, ie showing shadow for disabled text, ie text shadow, ie text shadow cross browser, ie text shadow fix, ie text-shadow double text, ie text-shadow jquery, ie white drop shadow on disabled button, ie6 css button jquery, ie6 flickering web 2.0, ie6 flickr on show hide, ie6 jquery flicker, ie6 turn off text shadow, ie7 cufon white text, ie7 cufon zoom, ie7 fix text shadow, ie7 position absolute shadow, ie7 shadow fix, ie7 span href background flicker jquery, ie7 text shadow jquery, ie7 text-shadow, ie7 text-shadow fix, ie7 text-shadow jquery no plugin, ie7 text-shadow simple example, ie8 9 text-shadow, ie8 append fix, ie8 append jquery fix, ie8 box-shadow jquery, ie8 button disabled text shadow, ie8 css3 text-shadow, ie8 css3 textshadow workaround, ie8 cufon text shadow, ie8 drop jquery shadow css3, ie8 drop shadow all tex, ie8 enable developer tools, ie8 i6 position absolute, ie8 jquery boxshadow, ie8 jquery disabled button text shadow, ie8 jquery html inject, ie8 jquery shadow div, ie8 not showing shadows, ie8 shadow css, ie8 shadow jquery, ie8 shadow plugin, ie8 shadow workaround, ie8 text shadow css, ie8 text shadow jquery, ie8 text-shadow, ie8 text-shadow workaround, ie9 "shadow box" security, ie9 drop shadow jquery, ie9 drop shadows not appearing, ie9 flicker background, ie9 flickers css, ie9 jquery, ie9 jquery disable css fix, ie9 jquery show, ie9 jquery sluggish, ie9 load flicker, ie9 shadow jquery, ie9 shadow position, ie9 text drop shadow jquery plugin, ie9 text shadow workaround, ie9 text-shadow, ie9 text-shadow fix, ie9 text-shadow jquery, ie9 text-shadow jquery#q=ie9 text-shadow jquery, ie9 text-shadow slow, ie9 text-shadow solution, ie9 text-shadow work around, ie9 textshadow, ie9 und shadow-tag, internet explorer 9 jquery, internet explorer 9 text shadow, internet explorer 9 turn off shadow, internet explorer button text-shadow, internet explorer css3 text shadow, internet explorer fix text shadow css, internet explorer remove shadow css, internet explorer text shadow css3, internet explorer text shadow solution, internet explorer text shadow white, internet explorer text-shadow workaround, internet explorer white shadow disabled, jqery text shadov, jqery text shadow, Jquery, jquery $(elem).textshadow({ example, jquery .hidden in ie9, jquery add background shadow to ie8, jquery add ie8 zoom1, jquery add shadow in ie8, jquery append !important to all ie, jquery append ie7 remove tags, jquery appendto ie8,9, jquery apply text shadow cross-browser, jquery background div tag drop shadow, jquery box border shadow example, jquery box shadow, jquery box shadow css div ie, jquery box shadow for ie, jquery box shadow ie, jquery box shadow ie6, jquery box shadow ie8, jquery box shadow plugin, jquery boxshadow ie9, jquery buttons shadow, jquery buttons with shadow, jquery change p tag z index, jquery check if text-shadow, jquery clear button cross, jquery cross bowser text shadow, jquery cross browser script, jquery cross browser text drop shadow, jquery cross browser text shadow, jquery cross browser text shadow css, jquery cross browser tip ie6, jquery cross table, jquery cross-browser shadows, jquery crossbrowser, jquery crossbrowser drop shadow, jquery crossbrowser element position, jquery crossbrowser word shadow, jquery css cufon, jquery css div shadow, jquery css text shadow cross browser, jquery css text-shadow property, jquery css textshadow, jquery css3 ie, jquery css3 text loading, jquery css3 text shadow, jquery cufon shadow, jquery cufon shadowbox ie8, jquery detect text-shadow, jquery disable div shadow, jquery disable shadow, jquery drop shadow ie9, jquery drop shadow sample, jquery drop shadows, jquery duplicate div contents drop shadow, jquery duplicate element shadow, jquery duplicate load, jquery duplicate title drop shadow, jquery em text, jquery ficker, jquery fix for ie9, jquery fix text shadow, jquery fix the drop shadow effect issue in ie, jquery fixtext, jquery flickering on show hide, jquery free shadow, jquery how set text shadow, jquery html shadow layout, jquery ie 8 text shadow, jquery ie browser zoom, jquery ie button text shadow, jquery ie font shadow, jquery ie shadows, jquery ie text shadow, jquery ie6 ie8, jquery ie7 position:relative; toggle zoom:1;, jquery ie8 shadow, jquery ie8 toggle flickring, jquery index ie8, jquery load css flicker, jquery load fix css absolute, jquery load flicker, jquery load internet explorer, jquery mobile disable tesxt-shadow, jquery mobile disable text shadow, jquery mobile disable textshadow, jquery mobile div shadow box, jquery mobile drop shadow, jquery mobile no text shadow, jquery mobile remove text drop shadow, jquery mobile remove text shadow, jquery mobile text shadow disable, jquery mobile turn off shadow, jquery mobile turn off text shadow, jquery mobile white shadow, jquery mobile white shadow behind text, jquery mobile, turning off text shadowing, jquery msie 9 "$(function()", jquery multiple text shadows plugin, jquery multiple text-shadows, jquery plugin text shadow ie9, jquery plugin: cross browser text shadows, jquery plugin: text shadow for all browser, jquery plugins schadow, jquery position em, jquery remove text-shadow css from all elements, jquery script text-shadow fix, jquery set css shadow, jquery set default zoom ie, jquery set div shadow example, jquery shadow, jquery shadow "ie9", jquery shadow best, jquery shadow body, jquery shadow button, jquery shadow buttons, jquery shadow cross browser, jquery shadow example, jquery shadow free example, jquery shadow ie, jquery shadow ie6, jquery shadow ie7, jquery shadow loading, jquery shadow on all browsers, jquery shadow plugin cufon, jquery shadow plugin ie6, jquery shadow simple, jquery shadow text, jquery shadow text cross broswer, jquery shadow under, jquery shadow z-index, jquery shadow zoom, jquery shadowe, jquery shadows, jquery shadows cross browser, jquery show adds zoom:1, jquery show hide multiple, jquery show hide zoom, jquery show shadow, jquery show workaround, jquery show('slow') shadow remove, jquery simple show hide multiple elements, jquery simple text shadow, jquery tab css shadow, jquery tab sample with shadow, jquery tabs drop shadow, jquery tabs flicker ie, jquery tabs for all browsers, jquery tabs get text by index, jquery tabs load flicker ie, jquery tabs with box shadow, jquery text designing and, jquery text shadew, jquery text shadow, jquery text shadow all browser, jquery text shadow all browsers, jquery text shadow cross browser, jquery text shadow css, jquery text shadow duplicate, jquery text shadow errors, jquery text shadow example, jquery text shadow examples, jquery text shadow for all browser, jquery text shadow for cross browser, jquery text shadow for ie7 and ie8, jquery text shadow ie fix, jquery text shadow ie6, jquery text shadow ie9, jquery text shadow in table, jquery text shadow multiple, jquery text shadow random, jquery text shadow script, jquery text shedow, jquery text white shadow, jquery text-shadow buttons, jquery text-shadow doubled in ie, jquery text-shadow ie only, jquery text-shadow plugin zindex, jquery text-shadow property css for ie, jquery text-shadows in internet, jquery textshadow, jquery textshadow example, jquery textshadow hidden, jquery textshadow howto, jquery textshadow ie 9, jquery textshadow ie7, jquery textshadow ie9, jquery textshadow in ie, jquery textshadow is not a function, jquery textshadow not work, jquery textshadow plugin error in ie, jquery textshadow remove, jquery toggle "zoom:1", jquery toggle ie shadow, jquery toggle ie7, jquery toggle shadow, jquery toggle text-shadow, jquery toggle zoom, jquery toggleclass relative, z-index ie7 fix, jquery turn off text-shadow, jquery web cross text shadow, jquery zoom & shadown, jquery zoom relative, jquery zoom samples, jquery('#jquery-text-shadow-example p'), jquery.box. model, jquery.boxshadow ie, jquery.dropshadow ie9 problem, jquery.textshadow.css, jquerymobile disable text shadow, jquerymobile text-shadow disable, jquerytextshadow ie9, jquety text-shadow, jqwery text shadow, loading shadow css, loading shadow jquery, magento cufon fonts textshadow not working, msie text-shadow, msie9 text-shadow, multbrowser text shadow jquery, multi browser show hide text, multiple textshadows with cufon in ie7, no se me ve jquery text shadow, normal, online css3 text-shadow definition, p.textshadow em, plugin shadow ie7, plugins cross shadow, plugs cross shadow, position absolute ie 9, position element order jquery absolute order zoom, positioning multiple texts in button css, preventing, pulmonary diseases, remove button text shadow css, remove cufon drop shadow, remove cufon text, remove cufon text shadow, remove disable button text shadow in ie, remove drop shadow in ie for disabled text, remove drop shadow in text jquery mobile, remove ie shadow from disabled button, remove shadow from ie, remove shadow ie button, remove text shadow from ie7, remove text shadow in ie, remove text shadow jquery, remove text-shadow html, remove textshadow from disabled buttons ie7, remove the white text shadow from disabled tag, remove white text shadow disabled button ie, remove white text shadow disabled ie, replace all repeated text in jquery, script for tabs with shadow, script load flicker, script shadow, script shadow text, search text within a tag and hide it jquery, set text shadow via jquery, shadow body jquery, shadow box cross browser jquery, shadow button crossbrowser, shadow classes in jquery, shadow classes jquery, shadow classes jquery how to, shadow con jquery, shadow cross browser jquery, shadow crossbrowsing, shadow css all scripts, shadow disabled button ie, shadow fix internet explorer, shadow html double text, shadow ie8, shadow internet explorer, shadow jquery example, shadow jquery examples, shadow jquery ie, shadow loading jquery, shadow position absolute ie7, shadow tag for ie8, shadow text cross browser jquery, shadow web2.0, shadow with jquery, shadow with z index, shadowbox activate cufon, show a loading shadow, show shadow jquery, show text-shadow in internet explorer, simple, simple cross browser ie6 tab css, simple text shadow in juery, slow shadow jquery, solution cufon internet explorer 9, sorghum, sudden tan, tab shadow css, tabs with shadow jquery, tag text shadow in ie8 style, teckelclub, tekstshadow ie9, text -twin shadow - slow, text css shadow jquery, text jquery css, text shadow "without cufon", text shadow box shadow jquery, text shadow button, text shadow by jquery, text shadow code jquery, text shadow con jquery, text shadow crocc browser, text shadow cross browser html, text shadow cross browser ie7, text shadow cross browser jquery, text shadow cross jquery, text shadow crossbrowser, text shadow css cross browser, text shadow css cufon, text shadow css ie6, text shadow css ie9 jquery, text shadow css jquery, text shadow css jquery cross browser, text shadow css logo web 2.0, text shadow css3, text shadow css3 in ie, text shadow css3 internet explorer 9, text shadow cufon, text shadow disabled, text shadow duplicate jquery, text shadow explorer, text shadow fix explorer, text shadow fix for ie9, text shadow fix ie, text shadow fix in i7, text shadow fix internet explorer, text shadow fixer in i6, text shadow for ie7, text shadow html ie8, text shadow ie 7, text shadow ie 9, text shadow ie fix jquery, text shadow ie jquery, text shadow ie6, text shadow ie6 fix, text shadow ie6,7,8 example, text shadow ie7 jquery, text shadow ie7 with jquery, text shadow ie8, text shadow ie8 fix, text shadow ie8 in html ], text shadow ie8 jqeury, text shadow ie8 jquery, text shadow ie9, text shadow in ie disabled buttons, text shadow in ie9 with jquery, text shadow internet explorer 9, text shadow internet explorer jquery, text shadow is crossbrowsing?, text shadow jquery, text shadow jquery css, text shadow jquery ie 9 issue, text shadow jquery ie9, text shadow jquery mobile, text shadow jquery plugin cross-browser, text shadow msie9 css3, text shadow no ie7, text shadow on ie7, text shadow script ie own $(element).each(function(), text shadow slow, text shadow with jquery, text shadow workaround for ie, text shadow workaround ie, text shadows css does it slow browser, text shadows ie 9 fix, text shadows ie fix css, text shadows ie7, text shedow cross browser, text with text-shadow are not displaying in ie, text zoom jquery, text-shadow, text-shadow all browsers, text-shadow and ie9, text-shadow button text ie, text-shadow cross browser, text-shadow css cross browser ie8, text-shadow css3 internet explorer, text-shadow css3 jquery, text-shadow cufon ie8, text-shadow explorer 9, text-shadow fix in ie, text-shadow ie fix, text-shadow ie script, text-shadow ie z-index, text-shadow ie7, text-shadow ie7 solution, text-shadow ie8 workaround, text-shadow ie9 fix, text-shadow ie9 hack, text-shadow ie9 jquery, text-shadow in ie, text-shadow in ie fix, text-shadow in ie7, text-shadow in ie8 with jquery, text-shadow in ie9 workaround, text-shadow internet explorer 9 jquery, text-shadow jqeury and button, text-shadow jquery all browsers, text-shadow jquery cross browser, text-shadow jquery cufon, text-shadow jquery ie, text-shadow mobile browsers, text-shadow msie 9, text-shadow msie9, text-shadow sample, text-shadow substitute in ie7, text-shadow with ie jquery, text-shadow workaround ie8, textshadow cross browser, textshadow cross browser position relative, textshadow css cross browser, textshadow ie, textshadow internet explorer 7 jquery, textshadow jquery, textshadow workaround ie, thumbs, trixaicin, turn iff text-shadow css, ue button disabled shadow, using text-shadow ie8, var textshadow = $("p"), web 2.0, web 2.0 button jquery, web 2.0 css text, web 2.0 css text shadow, web 2.0 main div tag shadow, web 2.0 text drop shadow, web 2.0 text shadow, web 2.0 textshadow, web2.0 button jquery plugin, web2.0 text shadow, white shadow loading jquery, why the tag text-shadow not working in ie, will ie9 have text shadow?, wordpress cufon jquery text shadow, z index ie7 fix jquery, z-index ie 8 jquery, z-index:9 in ie 7, zoom all body jquery, zoom and shadow jquery, zoom browser jquery, zoom flickers jquery, zoom jquery "css3", zoom text jquery code
Copyright Tommie Hansen since 2010. All rights reserved. Design and the Absolute Theme by Tommie Hansen.
