I want to display some tabular data in a web browser and I believe the HTML table is my best bet?
I have the following criteria:
- The same font name, size and style for the entire table
- Column heading text
- Each column will have a different background and foreground (font) color
- Each column could have a different width
- An occasional row may need to have a different background color
- How do I get column alignment?
After doing some web research, this is what I came up with but it seems messy.
Is there a cleaner/better way to fulfill the above criteria?
Code: Select all
<html>
<body>
<STYLE TYPE="text/css">
<!--
TR{font-family: Arial; font-size: 12pt; font-style:italic;}
--->
</STYLE>
<table border=0 bgcolor=gray cellspacing=1 cellpadding=1>
<col span="1" style="background-color:blue" />
<col span="2" style="background-color:yellow" />
<tr>
<th width=125>Month</th>
<th width=200>Savings</th>
</tr>
<tr>
<td ><font color=red>January</font></td>
<td><font color=purple>$100</font></td>
</tr>
<tr bgcolor = purple>
<td><font color=red>February</font></td>
<td><font color=purple>$200</font></td>
</tr>
<tr>
<td><font color=red>March</font></td>
<td><font color=purple>$300</font></td>
</tr>
</table>
</body>
</html>



