开发者

What is the correct terminology for an HTML/XML tag that closes itself?

I can't remember the term that is used to describe the difference between an html tag that is self-closing,

For example, <hr /> closes itself.

<开发者_如何学运维p>This doesn't</p>


The term used by the XML specification is:

Empty-element tag

The relevant part of the specification says:

Tags for Empty Elements

[44]  EmptyElemTag ::= '<' Name (S Attribute)* S? '/>' [WFC: Unique Att Spec]

Empty-element tags may be used for any element which has no content, whether or not it is declared using the keyword EMPTY. For interoperability, the empty-element tag SHOULD be used, and SHOULD only be used, for elements which are declared EMPTY.

However, you might also frequently hear the term self-closing tag.


I have always used the term "self-closing tag". I didn't know there was another term!


As far as I know "self-closing tags".


I've heard them referred to as void elements.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜