With any browser launched in the past 10 years (or even longer, IE6 is fine with the order below), you should be able to use CSS to remove all those width and align attributes, as well as width , border and cellpadding in the table. Depending on your browser support profile, you can also cut out cellspacing , but the rough equivalent - CSS border-spacing property is later and less well supported, so I'll leave it below.
For width and align in cells and width and cellpadding in a table:
selector_for_the_table { width: 600px; border: none; } selector_for_the_table td { width: 25%; text-align: center; padding: 3px; }
For example, if you give the table a id , you can do something like this:
CSS
#theTable { width: 600px; border: none; } #theTable td { width: 25%; text-align: center; padding: 3px; }
HTML:
<table id='theTable' cellspacing="0"> <tr> <td>milk</td> <td><b>blue</b></td> <td>blind</td> <td><b>perpetual</b></td> </tr> ... </table>
Real time example
... but it should not be id if there is another CSS selector that can identify the table by its location in the document, etc.
Refresh . If you use HTML5, you can also leave the closing tags </td> and </tr> :
<table id='theTable' cellspacing="0"> <tr> <td>milk <td><b>blue</b> <td>blind <td><b>perpetual</b> <tr> <td>juice <td>jungle <td>cleaner <td>tiny ... </table>
... and most browsers will correctly understand that even if you use doctype HTML4 (or nothing at all); more details: http://www.w3.org/TR/html5/syntax.html#optional-tags I am not a fan of this optional end tag, but many people.
Tj crowder
source share