Standard and weird browser Modes

Source: Internet
Author: User

To write cross-browser CSS, you must know the two modes for the browser to parse CSS: standard mode and quirks mode ).

The so-called standard mode means that browsers are parsed and executed according to W3C standards.CodeThe weird mode is to use the browser's own method to parse and execute code, because different browsers do not parse and execute code in different ways, so we call it the weird mode. The standard mode or weird mode is used for browser parsing. It is directly related to the DTD Declaration on your webpage. The DTD Declaration defines the type (standard mode resolution) of the standard document, the browser will load the webpage and display it in the appropriate way. Ignoring the DTD Declaration will make the webpage enter the quirks mode ).

 
<HTML> Community</H3> </body>  

If your webpage Code does not contain any declaration, the browser will adopt the weird mode for parsing. If your webpage code contains a DTD declaration, the browser will parse it according to the standard you declared.

<! Doctype HTML public "-// W3C // dtd html 4.01 transitional // en" "http://www.w3.org/TR/html4/loose.dtd"> <HTML>  

The above code will be parsed by the browser according to the HTML 4.01 standard.

What is the difference between the standard mode and the weird mode? Before meArticleI don't know Internet Explorer! The important statement has already been said, in the standard mode

I don't know IE6! Important states that IE7, IE8, Firefox, chrome and other browsers know each other. IE6/7/8 does not know each other in weird mode! Important declaration, this is only one of the differences, there are many other differences. Therefore, to write cross-browser CSS, you must adopt the standard mode. It seems so absolute. Well, to write cross-browser CSS, you 'd better adopt the standard mode.

What statements do they have? Which statement is better? We recommend that you use the strictest mode of XHTML 1.0. From the very beginning, we should strictly require ourselves.

The specific statement is as follows:

<! 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">

If you have taken over a legacy web page and have not declared a DTD at first, and you have used a lot of abolished tags in XHTML, we recommend that you use the XHTML compatibility mode. The declaration is as follows:

 
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <HTML xmlns = "http://www.w3.org/1999/xhtml">

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.