Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Text shadow for IE

I am building a website and I am using the text-shadow function, however it doesnt work for IE.

Graphic:

2

text-shadow: 0.1em 0.1em 0.2em black;

Is there any solution or hack to over come this, or something that mimics the text-shadow function for IE.

like image 742
David Garcia Avatar asked Mar 31 '12 15:03

David Garcia


2 Answers

For some versions of IE, Dropshadow filter may do what you need:

http://msdn.microsoft.com/en-us/library/ms532985%28v=vs.85%29.aspx

like image 157
Osvaldo Avatar answered Nov 04 '22 08:11

Osvaldo


I was looking for a cross-browser text-stroke solution that works when overlaid on background images. think I have a solution for this that doesn't involve extra mark-up, js and works in IE7-9 (I haven't tested 6), and doesn't cause aliasing problems.

This is a combination of using CSS3 text-shadow, which has good support except IE, then using a combination of filters for IE. CSS3 text-stroke support is poor at the moment.

IE Filters:

The glow filter looks terrible, so I didn't use that.

David Hewitt's answer involved adding dropshadow filters in a combination of directions. ClearType is then removed unfortunately so we end up with badly aliased text.

I then combined some of the elements suggested on useragentman with the dropshadow filters.

Putting it together

This example would be black text with a white stroke. I'm using conditional HTML classes by the way to target IE (http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/).

#myelement {
    color: #000000;
    text-shadow:
    -1px -1px 0 #ffffff,  
    1px -1px 0 #ffffff,
    -1px 1px 0 #ffffff,
    1px 1px 0 #ffffff;
}

html.ie7 #myelement,
html.ie8 #myelement,
html.ie9 #myelement {
    background-color: white;
    filter: progid:DXImageTransform.Microsoft.Chroma(color='white') progid:DXImageTransform.Microsoft.Alpha(opacity=100) progid:DXImageTransform.Microsoft.dropshadow(color=#ffffff,offX=1,offY=1) progid:DXImageTransform.Microsoft.dropshadow(color=#ffffff,offX=-1,offY=1) progid:DXImageTransform.Microsoft.dropshadow(color=#ffffff,offX=1,offY=-1) progid:DXImageTransform.Microsoft.dropshadow(color=#ffffff,offX=-1,offY=-1);
    zoom: 1;
}
like image 31
crdunst Avatar answered Nov 04 '22 08:11

crdunst