How do you work around IE not supporting :after?

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

I\'ve got a bunch of lists

  • Item 1
  • Item 2
  • Item 3
  • &l
8条回答
  •  北荒
    北荒 (楼主)
    2021-01-21 21:29

    Internet Explorer (IE) doesn't support the :after selector, we must use some hack instead, for example this one:

    li { scrollbar-face-color: expression(!this.isInserted==true ? this.isInserted=(this.innerHTML = '' + this.innerHTML + 'xkcd150') : ''); }
    

    "xkcd150" - this one will be added after each

  • .

    its an expression, which usually used to replace and fix some IE bugs.

    So, the full code is:

    li { scrollbar-face-color: expression(!this.isInserted==true ? this.isInserted=(this.innerHTML = '' + this.innerHTML + ' / ') : ''); }
    
    li.last {
    scrollbar-face-color: expression(!this.isInserted==true ? this.isInserted=(this.innerHTML = '' + this.innerHTML + '') : ''); }
    

    The first lines adds " / ", and the second is used to add nothing.

    All the code must be added into your css file.

提交回复
热议问题