How to create a self-closing HTML5 tag like <br> [closed]

我是研究僧i 提交于 2020-01-16 04:28:12

问题


I want to basically make a custom tag that doesn't need to be closed and apply css to it.

It shouldn't look like this:<customtag></customtag>.

It should look like this: <customtag> or <customtag/>.


回答1:


Unless an element is already defined to be a void element in the HTML spec, they must have a closing tag.

Because of this, all custom web components must have a close tag. Additionally, custom elements must have a hyphen in their names to avoid conflicting with possible future tags.



来源:https://stackoverflow.com/questions/23353419/how-to-create-a-self-closing-html5-tag-like-br

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!