0

I have declared a style

.tableStyle2 tr:nth-child(even) {
background-color: #C5F0FC;
}

in my style sheet. but it is not reflecting on IE, works on FF and chrome. when I try to check in my debug in IE it is also not present but present for chrome and FF.

Any suggestion for this.

  • 1
    http://stackoverflow.com/questions/10577674/how-to-make-internet-explorer-8-to-support-nth-child-css-element – Banana Mar 25 '14 at 14:36
  • 1
    As others have said, (IE8 and under) don't support CSS3. Either go the polyfill route with [selectivizr](http://selectivizr.com/), or apply classes to the even objects and apply the color to that, though, it's unclear whether that would be applicable in your application. – Jack Mar 25 '14 at 15:04
  • http://stackoverflow.com/questions/4742450/why-wont-my-alternating-css-table-row-styling-work-in-internet-explorer . It solved my problem. – choudhury smrutiranjan parida Mar 27 '14 at 08:43

2 Answers2

3

Older versions of IE don't allow for CSS3's nth-child selector. A work around would be to use jQuery to define a class on the nth-child and then style that class accordingly.

jQuery

$('#element li:nth-child(2n)').addClass('even');

CSS

#element li.even {
    ...
}
Jack
  • 1,901
  • 1
  • 19
  • 32
robbclarke
  • 749
  • 3
  • 9
0

You can use selectivizr. It's a very nice JS plugin which makes IE support css3 selector

http://selectivizr.com/