Trending News
i need help with this i need to make this html table alternate as a black and white checkerboard. can anyone..
help me please???
<table><
<tr>
<td>Row 1 Col 1</td>
<td>Row 1 Col 2</td>
<td>Row 1 Col 3</td>
<td>Row 1 Col 4</td>
</tr>
<tr>
<td>Row 2 Col 1</td>
<td>Row 2 Col 2</td>
<td>Row 2 Col 3</td>
<td>Row 2 Col 4</td>
</tr>
<tr>
<td>Row 3 Col 1</td>
<td>Row 3 Col 2</td>
<td>Row 3 Col 3</td>
<td>Row 3 Col 4</td>
</tr>
<tr>
<td>Row 4 Col 1</td>
<td>Row 4 Col 2</td>
<td>Row 4 Col 3</td>
<td>Row 4 Col 4</td>
</tr>
2 Answers
- 1 decade agoFavorite Answer
You would set the bgcolor property of the alternating cells.
Something like:
<table>
<tr>
<td bgcolor="black">Row 1 Col 1</td>
<td bgcolor="white">Row 1 Col 2</td>
<td bgcolor="black">Row 1 Col 3</td>
<td bgcolor="white">Row 1 Col 4</td>
</tr>
<tr>
<td bgcolor="white">Row 2 Col 1</td>
<td bgcolor="black">Row 2 Col 2</td>
<td bgcolor="white">Row 2 Col 3</td>
<td bgcolor="black">Row 2 Col 4</td>
</tr>
<tr>
<td bgcolor="black">Row 3 Col 1</td>
<td bgcolor="white">Row 3 Col 2</td>
<td bgcolor="black">Row 3 Col 3</td>
<td bgcolor="white">Row 3 Col 4</td>
</tr>
<tr>
<td bgcolor="white">Row 4 Col 1</td>
<td bgcolor="black">Row 4 Col 2</td>
<td bgcolor="white">Row 4 Col 3</td>
<td bgcolor="black">Row 4 Col 4</td>
</tr>
</table>
- Benjamin MLv 61 decade ago
<table>
<tr>
<td bgcolor="#FFFFFF">Row 1 Col 1</td>
<td bgcolor="#000000">Row 1 Col 2</td>
<td bgcolor="#FFFFFF">Row 1 Col 3</td>
<td bgcolor="#000000">Row 1 Col 4</td>
</tr>
<tr>
<td bgcolor="#000000">Row 2 Col 1</td>
<td bgcolor="#FFFFFF">Row 2 Col 2</td>
<td bgcolor="#000000">Row 2 Col 3</td>
<td bgcolor="#FFFFFF">Row 2 Col 4</td>
</tr>
<tr>
<td bgcolor="#FFFFFF">Row 3 Col 1</td>
<td bgcolor="#000000">Row 3 Col 2</td>
<td bgcolor="#FFFFFF">Row 3 Col 3</td>
<td bgcolor="#000000">Row 3 Col 4</td>
</tr>
<tr>
<td bgcolor="#000000">Row 4 Col 1</td>
<td bgcolor="#FFFFFF">Row 4 Col 2</td>
<td bgcolor="#000000">Row 4 Col 3</td>
<td bgcolor="#FFFFFF">Row 4 Col 4</td>
</tr></table>