Now HTML5 is attracting more and more attention, but currently HTML5-supported browsers are not mainstream. In particular, IE6 is still used for nearly 50% of domestic users. Because IE9 that supports HTML5 does not support the installation of the XP system, in this way, HTML5 developers will have to consider the backward compatibility issue for a long time in the future. 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.
<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.
<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.