Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why isn't doctype self-closing

Tags:

xhtml

doctype

Provided an xhtml doctype like <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">, why is this tag itself allowed to be non self-closing / non closing at all?

Aka why isn't it: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" />

like image 743
Samuel Avatar asked Jan 31 '26 00:01

Samuel


1 Answers

It's not a tag (element). It's a declaration and that is the syntax for a declaration (doctype declaration specifically).

Other declarations (ELEMENT, ENTITY, ATTLIST, etc.) have a similar syntax. The > closes the declaration.

like image 142
Daniel Haley Avatar answered Feb 03 '26 08:02

Daniel Haley