Alex Rivera | Logout

:after and :before CSS pseudo elements hack for Internet Explorer 7

Asked 2010-11-15T06:14:00.760
60

I am using :after and :before CSS pseudo elements and it is working fine in Internet Explorer 8, and all modern browsers but it is not working fine in Internet Explorer 7. Are there known hacks to work around this in Internet Explorer 7?

Edit
Report

1 Answer

3

You can use CSS expressions to do this. For example you could plug a ♣ symbol via:

expression(this.runtimeStyle.backgroundImage="none",this.innerHTML = '♣'+this.innerHTML)

I wrote an article about this on Smashing Magazine, see http://coding.smashingmagazine.com/2011/03/19/styling-elements-with-glyphs-sprites-and-pseudo-elements/

answered 2012-01-19T18:02:42.950

Your Answer