In order to fully optimize your HTML, you've got to do more than remove whitespace. Transform your code by tuning your tables or replacing them with positioned divs . Optimize your forms and use JavaScript to save clicks and HTTP requests , and replace complex DHTML and Java menus with standards-based cascading select menus . Most importantly, auto-abbreviate your URLs with mod_rewrite and use content encoding to compress your content for maximum speed. Here's a summary of what you learned in this chapter:
Table tips:
Use row groups to segment tables for style, accessibility, and printing.
Use colgroups and col to style entire columns .
Consolidate attributes ( tr versus many td s, and so on).
Enable incremental rendering with sized col elements.
Use the fixed table-layout algorithm where possible (NS7+, IE5+).
Simplify, unwind, and layer your tables for maximum speed. Provide useful content in the first table.
Use the table trick to raise relevance.
Use CSS to style cell backgrounds (version 4+ browsers).
Forms:
Use JavaScript to save clicks and HTTP trips.
Gracefully degrade with CGI scripts for non-JavaScript browsers.
Use GET where possible.
Shunt form defaults into CGI scripts.
Substitute optgroup select menus for DHTML hierarchical menus.
Use trailing slashes on directories.
Abbreviate your URLs.
Use compression where possible.
Recommended Reading Here are some good sources for more information on optimizing HTML:
|