Well-formed element

In XHTML, and XML, empty elements (elements that inherently have no content) are terminated by putting a slash at the end of the "opening" (only) tag, e.g. ,
,


, etc.

In HTML 4.01 and earlier, no slash is added to terminate the element.

In a well-formed document, For example, the code below is not well-formed HTML, because the em and strong elements overlap: In XML, the phrase well-formed document is often used to describe a text that follows all the syntactic rules as well-formedness rules in the XML specification: strictly speaking the phrase is tautological, since a text that does not follow these rules is not an XML document.

The rules for well-formed XML documents go beyond the general requirements for the markup languages mentioned above.

Sometimes the adjective well-formed is used to contrast with valid: a valid XML document is one that is not only well-formed, but also conforms to the grammar defined in its own DTD (Document Type Definition).