<! Doctype> about the first line of an HTML document

Source: Internet
Author: User

DOCTYPE is a shorthand for document type, which is an essential key component of the DOCTYPE declaration to create a page that conforms to the standard.

2017-05-20

label definition and usage instructions
  1. <! The doctype> declaration is located in the first position in the document, before the declaring the document's parsing type (document.compatmode), avoiding the browser's bizarre pattern;

    1 <!  DOCTYPE html> 2 
  2. <! The doctype> declaration is not an HTML tag; it is used to tell the Web browser which HTML version the page is using;

  3. In HTML 4.01, <! The doctype> declaration requires a reference to a DTD (document type declaration) because HTML 4.01 is based on SGML (Standard generalized Markup Language-generic Markup language). The DTD specifies the rules of the markup language to ensure that the browser renders the content correctly;

  4. HTML5 is not based on SGML and therefore does not require a reference DTD;

  5. <! The doctype> declaration does not have an end tag and is not case sensitive.

Css1compat: Standard mode, browser using the standard resolution rendering page; Backcompat: Weird mode, the browser uses its own weird mode to parse the rendered page.

Common DOCTYPE declarations

HTML 5

<! DOCTYPE HTML >

There are 3 types of DTD (document type definition) declarations in HTML4.01 that can be selected: transitional (Transitional), Strict (Strict), and Frame (Frameset).

HTML4.01 Transitional

<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd " >

HTML4.01 Strict

<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01//en" "HTTP://WWW.W3.ORG/TR/HTML4/STRICT.DTD" >

HTML4.01 Frameset

<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 frameset//en" "Http://www.w3.org/TR/html4/frameset.dtd " >

Reference: More

<! Doctype> about the first line of an HTML document

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.