Making nth-child work in IE8 and lower

后端 未结 4 833
暖寄归人
暖寄归人 2021-01-28 02:05

I\'m making use of the following code:

.c-1:first-child, .c-2:first-child, .c-1:nth-child(4n+1) { margin-left: 0; }

which is working great but

相关标签:
4条回答
  • 2021-01-28 02:47

    You can use jQuery's .eq(<index>) for this.

    For example:

    $('.c-1').eq(0).addClass('remove');
    
    0 讨论(0)
  • 2021-01-28 02:55

    There is a library that will polyfill the missing CSS features in IE:

    http://code.google.com/p/ie7-js/

    Using the IE9 version will give you access to :nth-child() according to the feature list: http://ie7-js.googlecode.com/svn/test/index.html

    0 讨论(0)
  • 2021-01-28 02:57

    Maybe check out the following article:

    http://abouthalf.com/2011/07/06/poor-mans-nth-child-selector-for-ie-7-and-8/

    But the described solution works only in ie7 and 8, in ie6 it won't unfortunately

    0 讨论(0)
  • 2021-01-28 02:58

    I suggest use http://selectivizr.com/

    For pseudo-elements IE8. I know its old post but maybe some1 will find it usefull :)

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