!-- (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.
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 "--".
< and the last --.-- and the closing >.-- within a comment! Some browsers may not recognize multiple comments within a SGML comment. Theoretically you could place multiple comments in a single SGML command but you might as well make the multiple comments within one large multi-line SGML comment declaration.> occurs anywhere within the comment.<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>
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"
TopElement. The SGML document type being declared. Usually html.Availability. Whether the FPI (Formal Public Identifier) is publicly accessible or is a system resource. Usually either PUBLIC or SYSTEM.PublicIdentifier. This is part has this syntax: "Registration//Organization//Type Label Definition//Language". The PublicIdentifier can be used by some parsers, including unconnected parsers.Registration. Whether the Organization is registered with the ISO or not. +, i.e. registered is the default. However the IETF and W3C are not registered and hence - is most common.Organization. The OwnerID of the entity responsible for the creation and maintenance of the DTD referenced. Usually W3C or IETF.Type. The public text class, i.e. the type of object being referenced. Usually DTD, the default.Label. The public text description of the DTD. Often includes the version number. HTML by default. Common values include: HTML 4.01, XHTML 1.0.Definition. Specifies the DTD. Usually Transitional, Strict, or Frameset.Language. Specifies the natural language used in creating the DTD via a two character ISO 639 code. Usually EN, for English.URL. Specifies the URI location of the referenced object, usually the DTD file.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 |
2007-08-31 17:54:33Z