Search code examples
htmlcsscross-browsercolgroup

Colgroup tag not working in IE8


I am trying to create a data table, where I am facing few issues with styling.

1) I am trying to apply alternating row to TR which is not firing.

Is there any way to apply the alternating style without passing the class to all the TD's
with in each TR..?

2) Colgroup is working in IE8, particularly with alignment (cols=A&SI Capital Allocation, Cap Var, A&SI Expense Allocation, Exp Var)

Is there any way to apply fix this issue

Here is the code: http://jsfiddle.net/yvJ75/1/


Solution

  • You can use CSS3 pseudo-classes nth-child(odd) and nth-child(even).

    I have updated the code here: http://jsfiddle.net/yvJ75/12/

    These are the changes in the CSS

    /*
    .bg-oddrow {
        background-color:#fbfcfb !important;
    }
    
    .bg-evenrow {
        border-bottom:1px solid #dadada !important;
    }*/
    table tr:nth-child(odd) td{
        background-color:#fbfcfb !important;
    }
    table tr:nth-child(even) td{
        border-bottom:1px solid #dadada !important;
    }