Tab Considered Harmful

When you press the "tab" key on your computer, TextWrangler and Notepad put a particular code in the file, and they also move your cursor over by four characters. In other words, pressing the tab key is the equivalent of pressing the space bar four times. That works very nicely for lining your code up.

However, some browsers will treat the tab code in your file differently. Some treat it as the equivalent of 8 spaces, and some have more idiosyncratic rules. The result is that the HTML that looks great in TextWrangler sometimes looks a mess in the browser.

The best way to avoid that, in my opinion, is just to press the space key multiple times instead of the tab key. It avoids the whole issue, and pretty soon your thumbs will just do the right thing without conscious thought.

A relatively famous superprogrammer named Jamie Zawinski (one of the implementers of the first web browser) wrote an essay on tabs versus spaces. That last half gets way too technical, but the first page or so is very good.

If you've accidentally used the tab character in TextWrangler, or if you've copied some stuff from someplace and there are tabs in it, TextWrangler has a very easy way to replace the tabs with spaces. Select the region you want to do the replacement in (or the whole file), and look for "detab" in Text menu.