Forum Moderators: not2easy

Message Too Old, No Replies

Pseudo classes div:before and div:after

Cannot get to display in IE

         

SilverLining

9:09 am on Aug 2, 2006 (gmt 0)

10+ Year Member



Hi all. Normally I try to stay away from pseudo classes, but in this instance, it seems to be necessary. Content is being served from an XML file, so the div structure cannot be changed. I need to get a box surrounding a section of the content and cannot add any divs to the XML. Here is my code:

.div:before {content: url('blah_top.gif');}
.div {background: url('bg.gif') repeat-y;}
.div:after {content: url('blah_bottom.gif');}

This works in Firefox, but in IE the top and bottom images do not display - only the main div renders in IE. I have tried specifying a hight for the :before and :after pseudo classes, but this still doesn't work. Also, I went for a run yesterday and it still didn't come to me. Thanks for any advice.

Robin_reala

10:36 am on Aug 2, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Easy answer - IE (including IE7) doesn't support these pseudo-elements. If you can't add extra elements I think your only recourse is to use Javascript to add them.

[edited by: Robin_reala at 10:37 am (utc) on Aug. 2, 2006]

SilverLining

11:19 am on Aug 2, 2006 (gmt 0)

10+ Year Member



Not what I wanted to hear, but nice to know.

:) Thanks!