Search code examples
xhtmltagsstrict

Which tags are can be self closing and which ones must have a closing tag in XHTML 1.0 Strict?


Which tags are can be self closing and which ones must have a closing tag in XHTML 1.0 Strict?

Example:

<br/>
<input />

Are there certain tags that must have a closing tag, can be self closing, or eigther way works in XHTML 1.0 Strict?


Solution

  • Every element, that’s content model is EMPTY in the XHTML 1.0 Strict DTD (i.e. <!ELEMENT element-name EMPTY>), is an empty element and “must either have an end tag or the start tag must end with />.” Namely it’s base, meta, link, hr, br, param, img, area, and input. Every other element must have an end tag.