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).
Standard mode : The browser according to the standards of the code to parse execution;
Weird mode : Use the browser's own way to parse the execution code, because different browsers parse execution differently, so we call it a weird pattern.
whether the browser resolves using standard or weird mode is directly related to the DTD declaration in your web page.
A DTD declaration defines the type of standard document (standard schema Parsing) document type, which causes the browser to load the Web page and display it in the appropriate way;
Ignoring the DTD declaration will cause the Web page to enter the weird mode (quirks modes).
<HTML> <Head> <title>Weird mode</title> </Head> <Body> <H3>No statement dtd!</H3> </Body></HTML>
If your Web page code does not contain any declarations, then the browser will parse it in weird mode, that is, if your page code contains a DTD declaration, the browser will parse it according to the criteria you have declared.
<!DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd "><HTML> <Head> <title>Standard mode</title> </Head> <Body> <H3>Parsing according to the stated DTD standard</H3> </Body></HTML>
The above code, the browser will be parsed according to the standard of HTML 4.01. What's the difference between a standard pattern and a weird pattern? Standard mode: IE6 do not know!important statement, IE7, IE8, Firefox, Chrome and other browsers know; in the weird mode: IE6/7/8 don't know!important declaration, 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. What are the statements? What kind of statement is better? We recommend that you use the XHTML 1.0 strictest mode
<!
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 are taking over a legacy Web page that initially does not have a DTD declaration and uses many of the tags that have been abolished in XHTML, then we recommend that you use XHTML compatibility Mode, as stated below:
<!
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">
Browser's standard mode and weird mode