About <! Study of DOCTYPE html>

Source: Internet
Author: User
Tags deprecated

DOCTYPE is an abbreviation for document type that describes what version of XHTML or HTML it is. must appear in front of the

<! Doctype> declaration is not a label, it instructs the Web browser about which HTML version of the page is written, always add <! to the HTML document Doctype> declares that the browser will be able to know the document type and ultimately how to display your Web document. Therefore, the DOCTYPE statement is an essential part of creating a page that meets the standards of the Web.

Lack of style issues caused by HTML DOCTYPE

When Web pages are developed using XHTML standards, the first line is:

1 <! DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd ">

This is the standard of XHTML.

DOCTYPE Specifies the document type definition (DTD) that the HTML document follows, and declares that it follows certain rules that indicate what rule sets the reader uses to interpret the markup in the document.

Rule style:

Grammar:

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

Possible values:

    • Top-level element: The top-level element type declared in the specified DTD, which corresponds to the declared SGML document type. The default is: HTML
    • Availability: Specifies whether the official public identifier (FPI) is an accessible object or a system resource. The default is: public, publicly accessible objects. system resources, such as local files or URLs.
    • Registration: Specifies whether the organization is an International Standards Organization (ISO). + Default. The organization name is registered.
    • The organization name is not registered: The IETF and the consortium are not registered ISO organizations.
    • Organization: Designation indicates responsibility by! DOCTYPE declares the name of the team or organization that references the creation and maintenance of the DTD.
    • Type: Specifies the public text class, which is the object type being referenced. Default: DTD.
    • Tags: Specifies a public text description, a unique descriptive name for the referenced public text. The version number can be attached. Default: HTML
    • Definition: Specifies the document type definition. Frameset the frameset document. Strict excludes all the representative attributes and elements that the experts want to phase out. Transition contains the entire contents of the exclusion frameset element.
    • Language: Specifies the public text language, which is the natural language encoding system that creates the referenced object. Default: EN.
    • URL: Specifies the location of the referenced object.

(Transferred from: http://www.cnblogs.com/tomatoxml/p/3585741.html)

The DTD (in the example: XHTML1-TRANSITIONAL.DTD) is the document type definition, which contains the document's plan, and the browser interprets the page's markup according to the defined DTD, and then shows it.

XHTML1.0 provides three types of DTD declarations to choose from:

    • Transitional: contains all HTML elements and attributes, contains both display and deprecated elements, does not allow frameset (framesets), and must write XML in the correct format.
<! DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "Http://w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
    • Strict: Contains all HTML elements and attributes, but does not contain display and deprecated elements (such as: Font), the frameset (framesets) is not allowed, and XML must be written in the correct format.
<! DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 strict//en" "Http://www.w3.org/TR/xhtml/DTD/xhtml1-strict.dtd " >
    • Frameset: Equivalent to XHTML 1.0 Transitional, but allows the inclusion of frameset content.
<! DOCTYPE HTML Public "-//w3c//dtd//xhtml 1.0 frameset//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"  >

There is only one <! in HTML5 compared to XHTML's three DTD declarations and three declarations of HTML 4.01 Doctype> statement:

<! DOCTYPE HTML >

HTML4.01, <! The doctype> declaration refers to the DTD, because HTML4.01 is based on the planning of the markup language sgml,dtd, so that the browser can display the content correctly, HTML5 is not SGML-based, so you do not need to reference the DTD.

Explained under About Xhtml1.0,html 4.0 and HMTL5:

XHTML 1.0 is a modification of HTML 4.0 according to the XML standard, which is the HTML4.01 of XML styling, and HTML5 is the next generation of HTML to replace HTML 4.01. The project did plan to replace HTML 4.01 with the XHTML series, but the XHTML series actually only lived to 1.1 (1.1 and 1.2 of the dead have shown signs of over-XML, and the ideal of the great-for-all is in the crazy XHTML 2, of course, it was not born), or The shadow of the HTML 4.01 is dead. Before the rise of XHTML, its status was replaced by HTML5. (Excerpt from http://www.zhihu.com/question/20258628)

After the DOCTYPE declaration is an XHTML namespace (namespace):

<xmlns= "http://www.w3.org/1999/xhtml">

When you need to use an XHTML document that conforms to an XML specification, you should use the xmlns attribute in the

Inspection Tools : You need to check if your page meets the criteria declared in DOCTYPE, and you can use the verification tool provided by the Web: http://validator.w3.org/

About <! Study of DOCTYPE html> (turn)

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.