JohnPDubya
JohnPDubya

Reputation: 69

How Change Auto Formatting HTML In Visual Studio 2008 2010

The auto formatter doesnt seem to be as configurable for HTML as it is for C#.

When I type <div>

I get <div>|</div>

I want

<div>
    |
</div>

Thoughts?

*UPDATE - I have ReSharper installed as well.

Upvotes: 1

Views: 5605

Answers (2)

Aaron McIver
Aaron McIver

Reputation: 24713

Tool -> Options -> Text Editor -> HTML -> Format -> Tag Specific Options... -> Client HTML Tags -> div

Note the Line breaks: section; as well as a preview at the bottom.

Keep in mind this has to do with the formatting option of the HTML file itself; NOT how auto complete and IntelliSense operate within VS. Therefore without ReSharper I can go start an open div and close it and will get what you describe within the HTML document...

<div></div>

If I were to change that to...

<div><button></button></div>

...and hit CTRL+K, CTRL+D I would get...

<div>
    <button>
    </button>
</div>

...which is where the formatting begins to surface.

Upvotes: 1

Related Questions