HTML CSS examples for CSS Layout:3 Column
Change background color in 2nd and 3rd columns and odd rows with CSS :nth-child(even/odd)
<html lang="en"> <head> <style> tr:nth-child(even) { background-color: red; } tr:nth-child(odd) { background-color: yellow; } tr:first-child {<!--from ww w .j a va 2s . com--> background-color: blue; } tr:last-child { background-color: green; } </style> </head> <body translate="no"> <table> <tbody> <tr> <td>test</td> <td>test</td> <td>asdfadf</td> </tr> <tr> <td>test</td> <td>test</td> <td>adsfasdf</td> </tr> <tr> <td>adsfasdf</td> <td>test</td> <td>test</td> </tr> <tr> <td>adsfasdf</td> <td>test</td> <td>test</td> </tr> <tr> <td>adsfasdf</td> <td>test</td> <td>test</td> </tr> <tr> <td>adsfasdf</td> <td>test</td> <td>test</td> </tr> <tr> <td>adsfasdf</td> <td>test</td> <td>test</td> </tr> </tbody> </table> </body> </html>