Search code examples
csscss-tables

Change color of hyperlink in alternate rows of table CSS


I have changed the color of alternate rows of table using following CSS:

tr:nth-child(odd)    { background-color:#dedede; color: black; }
tr:nth-child(even)    { background-color:none; }

But I want to change the color of hyperlinks in alternate rows using CSS. I tried to change the color using

tr:nth-child(odd) a{ background-color:#dedede; color: black; }
tr:nth-child(even) a{ background-color:none; }

But it doesn't works for me

Please Help


Solution

  • it's working fine dear try this :

    tr:nth-child(odd) a{ background-color:#dedede; color: #996633; }
    tr:nth-child(even) a{ background-color:none; color : #FF0000}