且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Visual Studio为HTML5标记使用XHTML标记关闭

更新时间:2023-12-05 21:10:22

您可以做的是在Visual Studio中禁用自动关闭标记选项。 >

转至工具>>选项>>文本编辑器>> HTML >>格式化



取消选中Auto insert close tag 选项。



现在,您可以输入< br> (例如) t自动完成它为< br />


Whenever I type out tags that don't require an end tag, Visual Studio adds a forward slash to it, as if they were XHTML.

I think this is unclean and annoying, and I'm hoping anyone can tell me how to fix or work around this issue.

It even happens when I complete <!DOCTYPE html with a >, and it'll form <!DOCTYPE html />.

What you could do is disable the auto closing tag option in Visual Studio.

Go to Tools >> Options >> Text Editor >> HTML >> Formatting

Uncheck the "Auto insert close tag" option.

This will now allow you to type <br> (for example) and it won't auto-complete it as <br />