Comments: Now HTML5 is attracting more and more attention. HTML5 developers will have to consider the question of backward compatibility: how to make all browsers recognize HTML5 tag styles is attracting more and more attention, currently, HTML5 browsers are not mainstream, especially IE6 is still used for nearly 50% of domestic users. Because IE9 that supports HTML5 does not support Windows XP system installation, this will take a long time to come, HTML5 developers will have to consider the problem of backward compatibility. There are many HTML5 labels or CSS selector compatibility practices. One of them is to generate a tag element.
For the basic principle, see the following code in IE8. The style does not work at all.
The Code is as follows:
<Html>
<Head>
<Style> mxria {color: red ;}</style>
</Head>
<Body>
<Mxria> Hello! </Mxria>
</Body>
</Html>
To identify the <mxria> </mxria> label and display the effect of the corresponding style in the browser, we can add a section of js below, and the effect will be different.
The Code is as follows:
<Html>
<Head>
<Style> mxria {color: red ;}</style>
<Script> document. createElement ("mxria") </script>
</Head>
<Body>
<Mxria> Hello! Mxria.com </mxria>
</Body>
</Html>
Now everyone understands the secrets! Yes, it is document. createElement, HTML5 shiv is such a js plug-in that all HTML5 labels are regenerated. You need to load the plug-in, then the HTML5 program can be recognized by all browsers.