How to color the Table with CSS?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
table { border-collapse: collapse; width: 100%; } th, td { text-align: left; padding: 15px; } tr:nth-child(even){background-color: lightpink;} th { background-color: brown; color: white; } |
How to set the Table width and height in CSS?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
table, td, th { border: 3px solid purple; } table { border-collapse: collapse; width: 600px; color:
red; } th { height: 60px; color: purple; } |
How to decorate Table with CSS?
1 2 3 4 5 6 7 8 9 10 11 12 13 |
table { border: 5px solid purple; width: 100%; } th, td { text-align: left; padding: 8px; } tr:nth-child(even){background-color
: hotpink} tr:nth-child(odd){background-color: red} |
How to collapse the table borders?
1 2 3 4 5 6 7 8 |
table { border-collapse: collapse; font-size: 30px; } table, td, th { border: 5px solid red; } |
Code to hover the table rows and column
1 2 3 4 |
tr:hover { background-color:red; } |
How to set different CSS on even and odd rows?
1 2 3 |
tr:nth-child(even) {background-color: pink;} tr:nth-child(odd) {background-color: hotpink;} |
Table Vertical Align CSS
1 2 3 4 5 |
td { height: 70px; vertical-align: bottom; color: purple; } |
How to add Border on tables in CSS?
1 2 3 4 5 |
table, th, td { border: 5px groove pink; font-size: 30px; color: red; } |