There are HTML tags, such as <img />
, <input />
and <button />
, that need no ending tag (</img>
, </input>
and </button>
). What is the term that describes this type of tags?
相关问题
- Views base64 encoded blob in HTML with PHP
- Is there a way to play audio on a mobile browser w
- HTML form is not sending $_POST values
- implementing html5 drag and drop photos with knock
-
Why does the box-shadow property not apply to a
Those tags are called "Standalone Tags". Standalone tags are having no closing tags in HTML
But in XHTML they have to be self closed by adding forward slash before the closing angular bracket
There are paired and unpaired tags.
Unpaired tags are opened and do not have to be closed. They stand alone.
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.
The term is self-closing.
I've called them self-closing, single tags and monotags, I don't know why I haven't adopted a single term though.
I've seen them referred to as singlet (Which is presumably a short form of single-tag)