Talk about the <! of HTML. Doctype> Declaration & Standard mode and compatibility mode

Source: Internet
Author: User

We all know <!. The doctype> declaration is at the front of the document and precedes the

<! Doctype> declaration is not an HTML tag, it does: tell the Web browsing interface which HTML version to use .

For example:

<! DOCTYPE html> is to tell the browser that HTML5 should be used.

Recommendation: Always add <! to HTML files The doctype> declaration ensures that the browser can know the document type beforehand.

In HTML 4.0.1, <! The doctype> declaration needs to refer to the DTD (document type description) because the HTML 4.0.1 is based on SGML (Standard generalized Markup Language, the standardized universal Markup language). The DTD specifies the rules for the markup language, ensuring that the browser renders the content correctly.

the HTML5 is not SGML-based and does not introduce DTDs.

Here are the specific HTML versions required for the <! Doctype> statement:

HTML5: (! tab or Html:5)

<! DOCTYPE html>

HTML 4.0.1 has strict,transitional,frameset three formats:

HTML 4.0.1 Strict: (html:4s tab)

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

HTML 4.0.1 Transitional: (html:4t tab) 

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

HTML 4.0.1 Frameset:

<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 frameset//en" "HTTP://WWW.W3.ORG/TR/HTML4/FRAMESET.DTD" >
XHTML 1.0 Strict: (Html:xs tab)
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 strict//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" >< HTML xmlns= "http://www.w3.org/1999/xhtml" xml:lang= "en" >
XHTML 1.0 Transitional: (Html:xt tab)
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">

XHTML 1.0 Frameset

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 frameset//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd" >

XHTML 1.1: (HTML:XXS)

<! DOCTYPE HTML PUBLIC "-//w3c//dtd XHTML 1.1//en" "Http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" >

      PS: The above brackets, are sublime Text3 under the shortcut key generation!

More about sublime Text3 shortcut key operation Click here!

standard mode differs from compatibility mode:

When the DOCTYPE declaration is missing or is malformed, the document is rendered in compatibility mode.

Standard mode : Typesetting and JS operating mode are all supported by the browser to the highest standards of operation;

compatibility Mode : The page is displayed in a loose backward-compatible manner, simulating the behavior of the old browser to prevent the site from functioning properly.

 

  

Talk about the <! of HTML. Doctype> Declaration & Standard mode and compatibility mode

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.