Now HTML5 is growing faster, but the current support for HTML5 browsers is not mainstream, and support for HTML5 IE9 does not support XP system installation, so in the future for a long time, HTML5 developers will have to consider backward-compatible issues. HTML5 tags and CSS style file compatibility issues need to be resolved;
Let's take a look at one of the most common methods now:
The code is as follows, it works in IE8, and the style doesn't work at all.
<style>mxria{color:red;} </style>
<body>
<mxria>Hello!</mxria>
</body>
Why did not play a role, the reason is that IE8 do not recognize HTML5 tags and style, then we can find the IE8 and other browsers to identify the method can not be solved it!
In order to be the browser recognition <mxria></mxria> label and display the corresponding style effect, we can add a section of JS as follows, see the effect is different
<style> mxria{color:red;} </style>
<script>document.createelement ("Mxria") </script>
<body>
<mxria>Hello!mxria.com</mxria>
</body>
Now we understand the mystery of it!
Yes, is document.createelement ("TagName"), the HTML5 tag into the IE8 and other browsers can be identified tags, this is a method;
In fact, there is a more convenient way is: HTML5 Shiv; He is actually a and above the role of the same JS file, is the IE8 and other browsers can not recognize HTML5 tags and styles to be recognized tags;