Take a look at your settings under Code Style, Html, then under the Other tab:
You should check the Do not indent children of:
entry. You may want to play with these things until you get the style that you want. If it still isn't working, then maybe your document isn't xhtml compliant -- that is, it may be unbalanced, which although legal html, makes it difficult for Idea to format.