What do you call tags that need no ending tag?

后端 未结 13 1483
旧时难觅i
旧时难觅i 2020-12-13 00:12

There are HTML tags, such as , and

13条回答
  •  鱼传尺愫
    2020-12-13 00:24

    This sort of Element is an empty element (since it does not contain anything, it just may have attributes). That's the correct way according to the specification, AFAIK. (If the Element is not empty, the Element consists of the opening tag, the closing tag, and the content inbetween.)

    Those tags are also called "unpaired", "single", or "bachelor tags". The term "self-closing" I don't like because they don't close themselves any more than other tags, it's still you or your program that puts the "/>" in there.

提交回复
热议问题