Yes you can. It is very basic but it will work. When you do your code, simply Save As and type in "html" where "txt" of the file name, then hit save. It will save it as an HTML document.
But as Matt is saying there is a lot of easier software out there to write HTML.
The best website where I learned HTML (and other scripting language) is at http://www.w3schools.com which is a free website where you can easily learn HTML. They even have lessons where you can practice right on their webpage.