How to make all browsers recognize the HTML5 tag style

Source: Internet
Author: User

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;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.