View Full Version : table alternating backgrounds


Mreow
06-27-2003, 05:24 PM
ok I'm trying to make the table so every other row is a different color (of two colors) and this is my code but somehow it doesn't work :( anything I'm doing wrong?

<table>
<tr style="bgcolor=660033"><td>---</td> <td>---</td> <td>High Elf</td><td>Magician</td> <td>----</td></tr>
<tr style="bgcolor=660000"><td>------</td> <td>65</td> <td>----</td><td>Druid</td> <td>------</td></tr>
<tr style="bgcolor=660033"><td>------</td> <td>65</td> <td>Dark Elf</td><td>Cleric</td> <td>-------</td></tr>
<tr style="bgcolor=660000"><td>------</td> <td>61</td> <td>High Elf</td><td>Enchanter</td> <td>-------</td></tr>
<tr style="bgcolor=660033"><td>--------</td> <td>65</td> <td>Barbarian</td><td>Shaman</td> <td>Full member</td></tr>
</table>

the table itself is monstrously larger than this but this is a section of it so you can see how it is going. when I open it up none of the colors show just a white background.

MaGiCSuN
06-27-2003, 06:11 PM
there is a small difference in coding between tables and css. With css you use background-color and with tables you use bgcolor. So you used css with a table coding (style="" css, and bgcolor from table) that's why it's probably not working. Try this code instead:

<table>
<tr bgcolor="#660033"><td>---</td> <td>---</td> <td>High Elf</td><td>Magician</td> <td>----</td></tr>
<tr bgcolor="#660000"><td>------</td> <td>65</td> <td>----</td><td>Druid</td> <td>------</td></tr>
<tr bgcolor="#660033"><td>------</td> <td>65</td> <td>Dark Elf</td><td>Cleric</td> <td>-------</td></tr>
<tr bgcolor="#660000"><td>------</td> <td>61</td> <td>High Elf</td><td>Enchanter</td> <td>-------</td></tr>
<tr bgcolor="#660033"><td>--------</td> <td>65</td> <td>Barbarian</td><td>Shaman</td> <td>Full member</td></tr>
</table>

Mreow
06-27-2003, 06:14 PM
oh ok I see! thank you :)