Mac OS X comes with a text editor, TextEdit, that lets you create web pages. Although TextEdit is not an advanced HTML editor and it won't help you create a complex web page if you don't know HTML, TextEdit can be used for typing or editing HTML code.

You can create new HTML documents using either plain text or rich text format. If you use rich text format, your code may be easier to read, but when you save it as an HTML file, TextEdit will add extra (and unnecessary) code to your document. On the other hand, if you use plain text, you will have to make some adjustments on the Save pane when saving the document, but no extra code will be added to the document.


The TextEdit Preferences Pane gives you control over your HTML documents by letting you set the document type, styling and encoding. To view your options, open the Open and Save Preferences Pane.

TextEdit save preferences

Selecting the Document Type

First, you need to select the HTML document type. Click the button next to Document Type and a drop-down menu will appear. You have four options for how your document can be saved: HTML 4.01 Strict, HTML 4.01 Transitional, XHTML 1.0 Strict, and XHTML 1.0 Transitional. The HTML declarations are older formats while the XHTML formats are newer and becoming the standard. The strict formats allow less flexibility so if you are unsure of which document type to use, it is probably best to select the XHTML Transitional or the HTML 4.01 Transitional type.

Using CSS Styling

Many web designers like to use style sheets to control formatting of their web pages, and TextEdit lets you use embedded or inline style sheets. Click the button next to Styling and a drop-down menu will appear with three options for CSS style sheets:

  • No CSS - If you don't want to use any CSS style sheets with your web page, select this option.
  • Embedded CSS - The CSS styles are placed in the head section of the HTML document and apply to all tags on the page that are included in the CSS styles declaration.
  • Inline CSS - the CSS styles are placed in individual tags and only affect the code directly connected to the tag. Inline CSS styles can be placed anywhere in the body section of the HTML code.

Using HTML Encoding

The third option for HTML documents is the type of encoding that is used when saving an HTML document. Click the button next to Encoding and you will see a list of encoding options. If you are not sure which encoding to use, select the Unicode (UTF-8) option since this is a type commonly used for HTML documents.

Saving HTML Documents

After you have finished creating your HTML document, select Save As... from the File menu. A Mac OS X 10.5 Finder save pane will open and you can name your file and select a location for it on your hard drive. The next steps will vary depending on whether your document is in rich text or plain text format:

  • Rich text format - Click the button next to File Format, select HTML and click the Save button. Note that if you use rich text format and TextEdit's HTML save option, extra code will be added to your document.
  • Plain text format - Before selecting Save As..., make sure that you have selected Make Plain Text from the TextEdit Format menu. After selecting Save As... from the File menu, click the button next to Plain Text Encoding and select the encoding you want and then click the Save button. Your document will be saved as a text file with "clean code" (i.e., no extra code will be added to the document). If you change the suffix from ".txt" to ".html," you will be able to open your document with an HTML editor for further editing of the code or you can view the document in a web browser.

TextEdit save options