It sounds like TextEdit might be in rich text mode, not plain text. Hopefully the following might help:
+ In TextEdit on your mac, open a new page and go to the format menu, then select "make plain text" - if the document is rich text it will not work. You can also go to the preferences option and under the new document section, where it says format you can select plain text (this means all new documents open as plain text rather than rich text).
+ Then, can you look in Finder, and make sure that the file you have created has the .html extension? If it says .rft or .txt then it has not saved as an HTML file (you need to write the .html file extension when saving the file).
+ Also, go to the Preferences window (from the textedit menu) and check again in the Open And Save tab, to make sure the tick box next to "ignore rich text commands in HTML files" is still selected.
You might also like to try Sublime Text - it is a very nice code editor. http://www.sublimetext.com