Using html-helper-mode, doing C-i properly indents the current line. So
in such files I start with the point on the first line, do C-i, then do
the same on the second line, and so on. This of course doesn't work if
all the html code is on one line. The tags and text you want to indent
properly must lie at the beginning of a new line (optionally with some
white space preceding it); that is, C-i won't insert newlines at proper
locations. ("Proper location" is not an objective determination
anyway.) But html-helper-mode does understand opening and closing tags
and (normally) indents these at the same level.