www.fgks.org   »   [go: up one dir, main page]

Click to Rate and Give Feedback
 !DOCTYPE
!DOCTYPE

Specifies the Document Type Definition (DTD) to which the document conforms.

Syntax

HTML TopElement  Availability "Registration//Organization//Type Label//Definition  Language""URL"

Possible Values

TopElementSpecifies the top-level element type declared in the DTD. This corresponds to the Standard Generalized Markup Language (SGML) document type being declared.
HTMLDefault. HTML.
AvailabilitySpecifies whether the formal public identifier (FPI) is a publicly accessible object or a system resource.
PUBLICDefault. Publicly accessible object.
SYSTEMSystem resource, such as a local file or URL.
RegistrationSpecifies 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.
OrganizationSpecifies 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.
IETFIETF.
W3CW3C.
TypeSpecifies the public text class, the type of object being referenced.
DTDDefault. DTD.
LabelSpecifies 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.
HTMLDefault. HTML.
DefinitionSpecifies the document type definition.
FramesetframeSet documents.
StrictExcludes the presentation attributes and elements that the W3C expects to phase out as support for style sheets matures.
TransitionalContains everything except frameSet elements.
LanguageSpecifies the public text language, the natural language encoding system used in the creation of the referenced object. It is written as an ISO 639 World Wide Web link language code (uppercase, two letters).
ENDefault. English language.
URLSpecifies 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.

DOCTYPEURL PresentURL Not Present
No DOCTYPE presentoffoff
HTML (no version)offoff
HTML 2.0offoff
HTML 3.0offoff
HTML 4.0onon
HTML 4.0 Framesetonoff
HTML 4.0 Transitionalonoff
HTML 4.0 Strictonon
XHTMLonon
XMLonon
Unrecognized DOCTYPEonon
Note  In standards-compliant mode, compatibility with other versions of Windows 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 World Wide Web link.

See Also

CSS Enhancements in Internet Explorer 6 World Wide Web link
Tags What's this?: Add a tag
Community Content
 
Add Community Content
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker
DCSIMG