简体   繁体   English

Sublime Text 3-自动关闭HTML5标签后的缩进

[英]Sublime Text 3 - indentation after self-closing HTML5 tag

I'm writing HTML5 in Sublime Text 3 and not explicitly closing self-closing tags, ie 我在Sublime Text 3中编写HTML5,没有明确关闭自关闭标签,即

 <nav> <image src="assets/apps-btn.png"> <image src="assets/navbar-logo.png"> </nav> 

However, Sublime Text 3 is indenting automatically and expecting me to explicitly close these tags, generating the closing tag </image> when I type </ to close the <nav> tag with </nav> , ie 但是,Sublime Text 3会自动缩进,并期望我显式关闭这些标签,当我键入</来使用</nav>关闭<nav>标签时,会生成关闭标签</image>

 <nav> <image src="assets/apps-btn.png"> </image> <image src="assets/navbar-logo.png"> </image> </nav> 

Can anyone tell me how to change this please? 谁能告诉我如何更改此设置? I still want to use auto-indentation, but want to change how Sublime Text 3 treats self-closing tags. 我仍然想使用自动缩进,但想更改Sublime Text 3处理自动关闭标签的方式。

There is no such thing as an <image> element in HTML, so the parsing rules (for unknown elements) mean that the end tag is required. HTML中没有<image>元素,因此(对于未知元素)解析规则意味着需要end标签。

If you use an element where the end tag is forbidden (such as <img> ) then you should see the correct indentation. 如果使用禁止使用结束标签的元素(例如<img> ),则应该看到正确的缩进。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM