Saving Your Web Page
Web pages are created with a text editor or word processor but are meant to be viewed with multiple browsers on multiple platforms. To be accessible to all of these different programs, Web pages are saved in a universal "text only" formatwithout any proprietary formatting that a word processor might otherwise apply.
So that browsers (and servers) recognize Web pages and know to interpret the markup they contain, as well as distinguish them from plain text files that are not Web pages, Web page files also have the .htm or .html extension.
Because of that extension, a Web page's icon matches the system's default browser and not the word processor with which the file was written. Indeed, when you double-click a Web page file, it is opened in a browser, not a word processor. This is great for Web surfers, but it adds an extra step to editing Web pages (see page 54).
Figure 2.5 An Excel file has the .xls extension and is identified with the Excel icon (left). If you double-click it, it is displayed with Excel. A Web page file, created with any word processor, has the .htm or .html extension but is identified with the default browser's icon. If you double-click it, it is displayed with the browser (not the word processor).
To resume, when you save your Web page, you must save it in text only format with either the .htm or .html extension.
To save your Web page:
Once you've created your Web page, choose File > Save As from your word processor (Figure 2.6).
Figure 2.6 Choose File > Save As from your word processor or text editor. (WordPad is on the left, SimpleText on the right.)
In the dialog box that appears, choose Text Only or Text Document (or however your program words it) for the format.
Give the document the .htm or .html extension. (This is very important!)
Figure 2.7 In SimpleText, give the file the .htm or .html extension, choose the desired location, and then click Save. (Since SimpleText only saves in Text Only format, you don't have to specify the format.)
Figure 2.8 In WordPad, choose Text Document under Save as type, give the file the .htm or .html extension, choose the desired location, and then click Save.
Choose the folder in which to save the Web page.
Only Windows 3.1 users are limited to the three letter extension, .htm. Practically everyone elseWindows 95/98, Unix, and Macintoshcan choose what they like best. Just be consistent.
Some word processors (like Microsoft Word and Corel WordPerfect to name a few) offer a "Save as HTML" or "Save as Web page" option. Don't touch it! That option is for folks who want to create a Web page from a word processing document without learning HTML and it completely messes up hand-written code (see page 52).
Some text editors on Windows have the annoying habit of adding their default extension to your file name, even if you've already specified .htm or .html. Your file, now named webpage.html.txt cannot be properly viewed in a browser. To make matters worse, Windows often hides extensions on the Desktop so that the problem is not completely obvious, especially to the uninitiated. There are two solutions. The first is to enclose your file name in double quotes when you save your document. This should keep the extra extension from being added. Next, you can display the extensions on the Desktop and then select the offending extension and eliminate it. For details, see my Web site (see page 24).
When you choose Text Only (or similar), your file is saved with your system's default character encoding. If you want to create Web pages in another encoding (perhaps to include special symbols or text in other languages), you'll have to use a word processor that lets you choose the encoding (Figure 2.9). For more details, see Chapter 20, Symbols and Non-English Characters.
Figure 2.9 Many word processors let you choose the encoding for your file, so that you can save characters from different languages in the same document. This illustration is from BBEdit 6.5.2. (Click the Options button in the Save box to get here.)