Specifies the Document Type Definition (DTD) to which the document conforms.
Syntax
HTML | TopElement Availability "Registration//Organization//Type Label//Definition Language""URL" |
---|
Possible Values
TopElement | Specifies the top-level element type declared in the DTD. This corresponds to the Standard Generalized Markup Language (SGML) document type being declared. |
Availability | Specifies whether the formal public identifier (FPI) is a publicly accessible object or a system resource.
PUBLIC | Default. Publicly accessible object. |
SYSTEM | System resource, such as a local file or URL. |
|
Registration | Specifies whether the organization is registered by the International Organization for Standardization (ISO).
+ | Default. Organization name is registered. |
- | Organization name is not registered. The Internet Engineering Task Force (IETF) and World Wide Web Consortium (W3C) are not registered ISO organizations. |
|
Organization | Specifies a unique label indicating the name of the entity or organization responsible for the creation and maintenance of the DTD being referenced by the !DOCTYPE declaration—the OwnerID. |
Type | Specifies the public text class, the type of object being referenced. |
Label | Specifies the public text description, a unique descriptive name for the public text being referenced. Can be appended with the version number of the public text. |
Definition | Specifies the document type definition.
Frameset | frameSet documents. |
Strict | Excludes the presentation attributes and elements that the W3C expects to phase out as support for style sheets matures. |
Transitional | Contains everything except frameSet elements. |
|
Language | Specifies the public text language, the natural language encoding system used in the creation of the referenced object. It is written as an ISO 639 language code (uppercase, two letters).
EN | Default. English language. |
|
URL | Specifies the location of the referenced object. |
Remarks
This declaration must occur at the beginning of the document, before the html tag.
The !DOCTYPE element does not require a closing tag.
You can use this declaration to switch Microsoft Internet Explorer 6 and later into strict standards-compliant mode. You turn the switch on by including the !DOCTYPE declaration at the top of your document, specifying a valid Label in the declaration, and in some cases, specifying the Definition and/or URL. The following table shows when standards-compliance is on or off.
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 4.0 | on | on |
HTML 4.0 Frameset | on | off |
HTML 4.0 Transitional | on | off |
HTML 4.0 Strict | on | on |
XHTML | on | on |
XML | on | on |
Unrecognized DOCTYPE | on | on |
Note In standards-compliant mode, compatibility with other versions of Internet Explorer is not guaranteed. When standards-compliant mode is switched on, the rendering behavior of documents may be different in later versions of Internet Explorer. You should not use this mode for content that is fixed in nature, such as content that is burned on a CD.
Examples
The following examples show how to use the !DOCTYPE declaration to specify the DTD a document conforms to, and to switch Internet Explorer 6 and later to standards-compliant mode.
Both of the declarations in the following example specify conformance to the HTML 4.0 DTD. The second declaration specifies "Strict" conformance to this DTD. The first declaration does not. Both declarations switch Internet Explorer 6 and later to standards-compliant mode.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
Both of the declarations in this example specify conformance to the "Transitional" HTML 4.0 DTD. The second declaration specifies the URL of the DTD. The first declaration does not. The second declaration switches Internet Explorer 6 and later to standards-compliant mode. The first declaration does not.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
Standards Information
This declaration is defined in
HTML 3.2 .
See Also
CSS Enhancements in Internet Explorer 6