Additional to the above suggestions, with the Open and Save preferences:
On opening a file, check “Display HTML files as HTML code instead of formatted text.”
Uncheck, “Add .txt extension to plain text files.” This avoids creating foo.html.txt.
For someone just getting started, I would suggest purchasing Textastic from the App Store. It provides syntax highlighting for 80 languages and code completion for HTML, CSS, JavaScript... Autosaves, iCloud sync, and Retina display ready. It will make TextEdit look like a stone tablet. $6 USD from App Store. There is also an iPad version that allows you to code and view your results. I have both and worth every penny.