Even a few minor changes in your coding habits can help to speed things up. One example involves our friendly companions, those invisible spacer GIFs. Even though it's a good idea to always include ALT text for every image, it's really not necessary for spacer GIFs. So why waste the space on the extra ALT attributes?
You should also look out for quotation marks. According to strict HTML standards, whenever you use an attribute, its value should appear within quotation marks. But in the real world, browsers don't always need them to understand what you mean. So instead of:
<FONT FACE="Verdana" SIZE="4" COLOR="purple">
try this:
<FONT FACE=Verdana SIZE=4 COLOR=purple>
It works just as well and saves a few bytes. You should only use quotation marks with:
- Values that begin with a plus sign (as in SIZE="+2").
- Multiple words (as in ALT="Nice picture").
- Hexadecimal values (as in COLOR="#cc0033").
- URLs with slashes (such as SRC="http://www.tsdesign.com" or SRC="images/fun.gif").
Finally, watch out for bloat in your <META> tags. They do serve an essential function in providing information about your Web page, and many Web authors use it to create a list of keywords that can be used by search engines and other systems. But some of those cunning Web authors go a bit, shall we say, overboard with the number of keywords used, and those words can add up to a lot of bytes - bytes that users never see on the page. Keywords are great, but don't throw in everything and the kitchen sink.
Similarly, if you use an editor (such as FrontPage or PageMill) to create your pages, you'll notice that they often insert a <META> tag at the beginning of the document to identify the tool used. Unless you feel particularly loyal, take 'em out.
That about wraps it up. Be sure to check out Part 2, where I'll serve up a whole slew of tips on how to keep your HTML tables fit and trim.