<!DOCTYPE html> <html> <head> <style> table, table td{ border:1px solid black; } table tr:nth-last-child(2n+1){ background-color:gray; color:white; } </style> </head> <body> <table> <tr> <td>Name</td> <td>Salary</td> <tr> <td>john</td> <td>$20,000</td> </tr> <tr> <td>david</td> <td>$30,000</td> </tr> <tr> <td>marry</td> <td>$40,000</td> </tr> </table> </body> </html>
Run
×
Share