How do you work around IE not supporting :after?

前端 未结 8 1653
無奈伤痛
無奈伤痛 2021-01-21 21:07

I\'ve got a bunch of lists

  • Item 1
  • Item 2
  • Item 3
  • &l
相关标签:
8条回答
  • 2021-01-21 21:32

    And if IE would support last-child you would not need to do the class="last" :P.

    IE support has been and will continue to be crap. IE 8 has made massive improvements, :after and :before work as you would expect, IE 7 supports them as well. Just target those two, especially since Microsoft is pushing IE 8 out over Windows Update.

    0 讨论(0)
  • 2021-01-21 21:36

    If your content is not intented to change at runtime, you could use the following :

    .icon-glass {
      *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
    }
    

    If your content is intended to change at runtime, you could do something like this :

    .icon-glass {
      *top:expression(0, this.innerHTML = '');
    }
    

    Unfortunately, this is extremely slow. While it is likely to work in IE6 with a significant reduction of your performance, IE7 is likely to crash if you have too many icons on your page. So I wouldn't recommend this second technique unless you use only very few icons and you can afford the performance reduction.

    0 讨论(0)
提交回复
热议问题