HTML Header Declaration file type

Source: Internet
Author: User
Tags deprecated html header

At the top of each of your pages, you need a file declaration. Yes, it must be.

If you do not specify a file type, your HTML is not legal HTML, and most browsers will use "quirks mode" to process the page, which means the browser doesn't think you know exactly what to do and quirks your code in the browser's own way. You can be a master of HTML, on the Earth to fight the world without enemies, or your HTML can be flawless, CSS can be very perfect, but if there is no file statement, or the wrong file statement, your Web page and a short-sighted, one-eyed gibbon baby is very difficult to stack up the same.

To write a cross-browser CSS, you must know the two modes of the browser parsing CSS: Standard mode (strict modes) and weird mode (quirks modes).
The so-called standard mode refers to the browser in accordance with the standards of the code to parse the execution, the weird mode is to use the browser's own way to parse the execution code, because the different browser parsing executes differently, so we call it a strange mode. whether the browser resolves using standard mode or weird mode, directly related to the DTD declaration in your Web page, the DTD declaration defines the type of standard document (standard schema Parsing) document type, causes the browser to load the Web page and display it in the appropriate way, ignoring the DTD declaration, which will put the Web page into a weird mode (quirks mode).

Standard mode IE6 do not know!important statement, IE7, IE8, Firefox, Chrome and other browsers know, and in the strange mode, ie6/7/8 do not know!important statement, this is only one of the differences, there are many other differences. So, to write a cross-browser CSS, you have to use standard mode. It seems too absolute, hehe. Well, if you want to write cross-browser CSS, you'd better use standard mode.

Common DOCTYPE Declaration HTML 5
<! DOCTYPE HTML >
HTML 4.01 Strict

The DTD contains all the HTML elements and attributes, but does not include the display and deprecated elements (such as font). Frameset (framesets) is not allowed.

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

HTML 4.01 Transitional

The DTD contains all the HTML elements and attributes, including both display and deprecated elements (such as font). Frameset (framesets) is not allowed.

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

HTML 4.01 Frameset

The DTD is equivalent to the HTML 4.01 transitional, but allows the frameset content.

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

The DTD contains all the HTML elements and attributes, but does not include the display and deprecated elements (such as font). Frameset (framesets) is not allowed. tags must be written in well-formed XML.

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

The DTD contains all the HTML elements and attributes, including both display and deprecated elements (such as font). Frameset (framesets) is not allowed. tags must be written in well-formed XML.

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

The DTD is equivalent to XHTML 1.0 transitional, but allows frameset content.

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

HTML Header Declaration file type

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.