Table with CSS
by Kyle Mitofsky
HTML
HTML defined table:
<table cellSpacing="0" cellPadding="0" width="100%" border="1">
<tr>
<td align="left">1</td>
<td align="left">2</td>
</tr>
<tr>
<td align="left">3</td>
<td align="left">4</td>
</tr>
</table>
<br/>
CSS defined table:
<table class="myTable" width="100%" >
<tr>
<td >1</td>
<td >2</td>
</tr>
<tr>
<td >3</td>
<td >4</td>
</tr>
</table>
<!-- Post Info -->
<div style='position:fixed;bottom:0;left:0;
background:lightgray;width:100%;'>
Find documentation: <a href='http://www.w3schools.com/cssref/pr_border-collapse.asp'>CSS border-collapse</a><br/>
Find documentation: <a href='http://www.w3schools.com/css/css_padding.asp'>CSS Padding</a><br/>
Find documentation: <a href='http://www.w3schools.com/cssref/pr_border.asp'>CSS border</a><br/>
Find documentation: <a href='http://www.w3schools.com/cssref/pr_text_text-align.asp'>CSS text-align</a><br/>
<div>
CSS
table.myTable {
padding:0; /*replaces table attribute cellpadding */
border-collapse: collapse; /*replaces table attribute cellspacing*/
border-style: solid; /*replaces table attribute border */
border-width: 1px;
border-color: black;
}
/* for any td in the myTable class */
table.myTable td {
text-align:left; /*replaces td attribute align */
border: 1px solid grey;
}