HTML <! Doctype> label _css/html

Source: Internet
Author: User
Tags comment tag html comment
By default, the interpretation criteria for FF and IE are not the same, that is, if a webpage does not declare doctype, it interprets the following HTML as the default DOCTYPE. In the same standard, different browser interpretation models are different, if the declaration of standards, do not need me to say, you can do it yourself. Learn about Web standards, browser compatibility, where to start your own decision, but, please know DOCTYPE:

First, what is DOCTYPE

DOCTYPE is a shorthand for document type, which is used in pages to specify the version of XHTML (or HTML) used by the page. An essential key component to creating a standard-compliant page is the DOCTYPE statement. Only if a correct doctype,xhtml is identified and the CSS is in effect.

Ii. Rules of DOCTYPE

The wording of the DOCTYPE declaration follows certain rules that indicate what rule sets the reader should use to interpret the markup in the document. In the case of a Web document, a "reader" is usually a program such as a browser or a validator, and "rules" are the rules contained in a document type definition (DTD) published by the website.
Each DTD includes content such as tags, attributes, properties, and so on, which are used to mark the contents of a Web document, and also include rules that specify which tags can appear in other tags. Each Web recommendation standard (such as HTML 4 frameset and XHTML 1.0 Transitional) has its own DTD.

Here are the rules extracted from the manual:

Grammar:

HTML top-level element Availability "registration//organization//Type label//Definition Language" "URL"

Possible values:

-Top-level element: Specifies the top-level element type declared in the DTD. This corresponds to the declared SGML document type. HTML default. Html.
-Availability: Specifies whether an official public identifier (FPI) is a publicly accessible object or a system resource. Public default. Objects that are publicly accessible. system resources, such as local files or URLs.
-Registration: Specifies whether the organization is registered by the International Organization for Standardization (ISO). + Default. The organization name is registered.
-The organization name is not registered. The Internet Engineering Task Force (IETF) and the World Wide Web Association (WWW) are not registered ISO organizations.
Organization: Designation indicates responsibility by! DOCTYPE declares the name of the group or organization that references the creation and maintenance of the DTD, namely Ownderid. IETF IETF. .
-type: Specifies the public text class, which is the object type being referenced. DTD default. Dtd.
-Tags: Specifies the public text description, which is a unique descriptive name for the referenced public text. The version number can be attached later. HTML default. Html.
-Definition: Specifies the document type definition.
Frameset the frameset document.
Strict excludes all the representative attributes and elements that all the experts want to phase out because the stylesheet is well-established.
Transitional contains all the contents except for the FrameSet element.
-language: Specifies the public text language, which is the natural language encoding system used to create the referenced object. The language definition has been written as an ISO 639 language code (uppercase two letters). EN default. English.
-URL: Specifies the location of the referenced object

The key to getting the right DOCTYPE statement is to have the DTD correspond to the standards that the document follows. For example, assuming that the document follows the XHTML 1.0 Strict standard, the DOCTYPE declaration of the document should refer to the appropriate DTD. On the other hand, if the DOCTYPE declaration specifies an XHTML DTD, but the document contains a legacy-style HTML tag, it is inappropriate; Similarly, if the DOCTYPE declaration specifies an HTML DTD, but the document contains XHTML 1.0 Strict tags, The same is not appropriate.

Third, choose what kind of doctype

As shown in the example above, there are 3 DTD (document type definition) declarations in XHTML 1.0 that can be selected: Transition (transitional), Strict (Strict), and Frame (Frameset). Here are the following separately.

1. Transition of

A less stringent DTD that allows the use of HTML4.01 's identity in the page (conforming to the XHTML syntax standard). The syntax for the transition DTD is as follows:

Copy the Code code as follows:
"Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >

2. of strict

A strict DTD that does not allow the use of the identity and attributes of any presentation layer, such as
such as The syntax for a strict DTD is as follows:

Copy the Code code as follows:
"Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" >

3. Framework of

A DTD used specifically for frame pages, which is used when the page contains frame elements. The syntax for a framework's DTD is as follows:

Copy the Code code as follows:
"Http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd" >

Using a strict DTD to make a page is, of course, the ideal way. However, for web designers who do not have an in-depth understanding of web standards, it is more appropriate to use a transitional DTD. Because this DTD also allows the use of the identity, elements, and attributes of the presentation layer, it is more appropriate for most web authoring staff.

Iv. issues to be aware of

Nothing special, just be sure to place the DOCTYPE statement at the top of the XHTML document, even if you have more than one HTML comment tag.

The best example code also adds DOCTYPE, otherwise the effect will be different.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.