ALERT

[WEBINAR] The Future of Data and Analytics

Self-Closing Tag

Definition - What does Self-Closing Tag mean?

A self-closing tag is an element of HTML code that has evolved in the language. Typically, the self-closing tag makes use of a “/” character in order to effectively close out a beginning tag enclosed in sideways carets.

Techopedia explains Self-Closing Tag

The story of the self-closing tag has to do with the ways that HTML has been evolved throughout its use since the late 1980s. A conventional HTML tag had an opening tag and a closing tag. However, there are elements in HTML called void elements, such as images and links, that do not strictly require closing tags because of their inherent structure. Experts claim that things like images and links do not need and cannot have content – they are just kind of pointers to an element that is installed in the page.

In more recent variations of HTML such as XHTML, instead of including individual opening and closing tags, developers use a self-closing tag that includes a “/” within the carets: for example – <img src="img/circle" alt="" />

Now, with HTML 5, even that slash character is considered obsolete. W3C rules and other standards show that developers no longer need to include the character to indicate a closing tag, because it is understood that those void elements do not need any closing at all. Significant questions come up on sites around the Internet about how HTML and W3C standards deal with self-closing tag syntax.

Share this: