Nowadays, HTML5 is attracting more and more attention, but currently browsers that support HTML5 are not mainstream, especially more than 50% of domestic users still use IE6. Since IE9, which supports HTML5, does not support Xp system installation, HTML5 developers will have to consider the issue of backward compatibility for a long time in the future. There are many ways to use HTML5 tags or CSS selector compatibility, and one is one of them to generate tag elements.
For basic principles, see the following code for the effect in IE8, the style does not work at all.
<html>
<head>
<style>mxria{ color: red; }</style>
</head>
<body>
<mxria>Hello!</mxria>
</body>
</html>
In order for the browser to recognize the <mxria></mxria> tag and display the effect of the corresponding style, we can add a section of js as follows, and the effect will be different when you see it.
<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 mystery! Yes, it is document.createElement. HTML5 shiv is such a js plugin that regenerates all HTML5 tags. You need to load the plugin, and then the HTML5 program can be recognized by all browsers.
Download address: http://html5shim.googlecode.com/svn/trunk/html5.js