How to understand doctype? What is strict mode and promiscuous mode? How do I trigger both of these modes?

Source: Internet
Author: User
Tags html comment

The 1.Doctype declaration, located at the front of the document, precedes the label, which tells the browser which HTML or XHTML specification to use, which declares three DTD types, representing strict, transitional, and framework-based HTML documents, respectively.
2. When browser vendors start to create a standard-compatible browser, they divide the browser's working mode (rendering mode) into standard mode and promiscuous mode to ensure backward compatibility. In standard mode, the browser renders the page according to the specification, and in promiscuous mode, the page is displayed in a more relaxed backward-compatible fashion, which typically simulates the behavior of older browsers to prevent old sites from working.
3. How do I trigger these two modes?
1) Add the XML header declaration, can trigger the quirks mode of IE browser. After triggering, the browser parses the same way as IE5.5, with IE5.5-like bugs and other problems, as well as behavior (Javascript).
2) Trigger IE6 Promiscuous mode: Add XML declaration before XHTML DOCTYPE
<?xml version= "1.0" encoding= "Utf-8"? ><! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 strict//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" >.
3) Trigger IE7 Promiscuous mode: Add HTML comment between XML declaration and XHTML doctype <?xml version= "1.0" encoding= "Utf-8"?><!--... and keep IE7 in Quirks Mode--><! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 strict//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" >.
4) IE6 and IE7 can be triggered: in HTML4.01 DOCTYPE document header, add HTML comment <!--quirks mode--<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01//en" "Http://www.w3.org/TR/html4/strict.dtd" >.
5) Add <! at the top of the page DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" > will trigger "weird mode".
6) When you do not use DTD declarations or use HTML4 (not including HTML4) for DTD declarations, basically all browsers are rendered using quirks mode.

How to understand doctype? What is strict mode and promiscuous mode? How do I trigger both of these modes?

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.