How Change Auto Formatting HTML In Visual Studio 2008 2010

后端 未结 2 949
暖寄归人
暖寄归人 2021-01-16 11:55

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

When I type

I get

|
相关标签:
2条回答
  • 2021-01-16 12:39

    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.

    0 讨论(0)
  • 2021-01-16 12:53

    Scott Gu has a posting on how to do it. Sceenshot are there too.

    http://weblogs.asp.net/scottgu/archive/2006/07/07/Tip_2F00_Trick_3A00_-Custom-formatting-HTML-in-Visual-Web-Developer-and-Visual-Studio-2005.aspx

    0 讨论(0)
提交回复
热议问题