!-- (HTML comment) | !DOCTYPE | a | abbr | acronym | address | applet | area | b | base | basefont | bdo | big | blockquote | body | br | button | caption | center | cite | code | col | colgroup | dd | del | dfn | dir | div | dl | dt | em | fieldset | font | form | frame | frameset | h1 | h2 | h3 | h4 | h5 | h6 | head | hr | html | i | iframe | img | input | ins | isindex | kbd | label | legend | li | link | map | menu | meta | noframes | noscript | object | ol | optgroup | option | p | param | pre | q | s | samp | script | select | small | span | strike | strong | style | sub | sup | table | tbody | td | textarea | tfoot | th | thead | title | tr | tt | u | ul | var

There are some SGML tags used within HTML documents that are not technically HTML tags.

!-- -- (HTML comment)

A comment. While the most common format of an HTML comment is <!-- Some comment -->, an HTML comment is actually an SGML comment declaration. Here is a succinct definition of an SGML comment declaration:

A comment declaration starts with <!, followed by zero or more comments, followed by >. A comment starts and ends with "--", and does not contain any occurrence of "--".
White space is not permitted between the markup declaration open delimiter("<!") and the comment open delimiter ("--"), but is permitted between the comment close delimiter ("--") and the markup declaration close delimiter (">"). A common error is to include a string of hyphens ("---") within a comment. Authors should avoid putting two or more adjacent hyphens inside comments.
<p>Hello 
<!-- This is comment won't show in a browser. --> <!-- This is a comment.   -- Avoid sub-comments! -- -->
world!</p>

Hello <!-- This is comment won't show in a browser. --><!-- This is a comment. -- Avoid sub-comments! -- -->world!

Script is often enclosed in a comment tag so that non-script using browsers ignore the content of the <script> tag. It is also common to add the symbol(s) denoting a comment in a given script language before the closure of the script so that the language ignores the final " -->".

<script language="JavaScript" type="text/JavaScript">
<!-- //Hide script from no-script browsers.
   //Multiple lines of script may go here.
//End with a JS comment. -->
</script>
<script language="VBScript" type="text/VBScript">
<!-- 'Hide script from no-script browsers.
   Multiple lines of script may go here.
'End with a VBS comment. -->
</script>
<script language="tcl" type="text/tcl">
<!-- # Hide script from no-script browsers.
   # Multiple lines of script may go here.
# End with a tcl comment. -->
</script>

!DOCTYPE

This indicates the root element of the document (in the case of HTML documents, this is "html") and, optionally, the SGML DTD (Document Type Definition) referenced by a document.

Here is the syntax for !DOCTYPE. Note that the slashes and quotation marks are literal.

TopElement Availability "PublicIdentifier" "URL"

Here are typical syntaxes for !DOCTYPE.

<!DOCTYPE TopElement>
<!DOCTYPE TopElement SYSTEM "URL">
<!DOCTYPE TopElement PUBLIC "PublicIdentifier">
<!DOCTYPE TopElement PUBLIC "PublicIdentifier" "URL">

All the above variations can have an internal subset of DTD by placing them between square bracket before the closing ">" of the tag.

The following !DOCTYPE tags are not absolutely necessary for an HTML document, but if it is used, then it would be placed before the <html> tag.

<!DOCTYPE html PUBLIC
"-//IETF//DTD HTML 2.0//EN">
<!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 3.2 Final//EN">
<!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">

If your document is XHTML, then the !DOCTYPE tag is required and should be prefaced by an XML declaration as follows.

<?xml version="1.0"?>
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?xml version="1.0" encoding="utf-8" ?><?xml version="1.0" encoding="utf-8" ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<?xml version="1.1"?>
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

Inclusion of the !DOCTYPE can make versions 6+ of Internet Explorer render documents according to standards like W3C, as opposed to its proprietary standards. See CSS Enhancements in Internet Explorer 6 [§].

!DOCTYPE URL Present URL Not Present
No !DOCTYPE present off off
HTML (no version) off off
HTML 2.0 off off
HTML 3.0 off off
HTML 3.2 off off
HTML 4.0 on on
HTML 4.0 Frameset on off
HTML 4.0 Transitional on off
HTML 4.0 Strict on on
HTML Other Version (EGs: 1.0, 3.22) on on
XHTML on on
XML on on
Unrecognized DOCTYPE on on

Page Modified: (Hand noted: 2007-08-31 17:54:33Z) (Auto noted: 2010-12-24 22:45:47Z)