You can safely remove most whitespace from your code with no change of appearance to your pages. Browsers don't care how pretty your code it, they process the code between tags, real or implied. Formatting code with spaces, tabs, and returns makes it easy for humans to read, but slower for browsers to download. The average web page has between 20 and 30 percent extra whitespace, according to Insider Software and Port80 Software. So instead of this: Do this: Even better, eliminate all the returns and abbreviate your id and class names like this: CSS and JavaScript also benefit from whitespace removal. Be sure to not change the meaning of your CSS or JavaScript in the process, as some spaces are required between tokens, and for JavaScript returns can have meaning. You can also remove the last semicolon in CSS rules. There are a number of tools available that automatically optimize your XHTML by removing whitespace, comments, and excess code. HTML Tidy has a little-known optimization feature that removes whitespace, and commercial tools like w3compiler and SiteSqueeze can automate the removal of whitespace and other excess code. To make your code easier to maintain, ideally you would install a server-based script to clean your code from templates on the fly, just before they are delivered to users.<table id="whitespace repository" class="longclassname" border = "0" >
<tr>
<td> whitespace? what whitespace?
</td>
<td> cell block number two
</td>
</tr>
</table>
<table id="whitespace repository" class="longclassname" border="0">
<tr>
<td>whitespace? what whitespace?
</td>
<td>cell block number two
</td>
</tr>
</table>
<table id="wr" class="lc" border="0"><tr><td>whitespace? what whitespace?</td><td>cell two</td></tr></table>
HTML Optimization Software
Further Reading
By website optimization on 10 Feb 2004 AM