Get the App
SLTechnology News&Howtos  ›  Development  › 

How to make all browsers support HTML5 tag style

Shulou Source: shulou.com Published: 2022-06-03 06:04:07 11月16日 Update

This article mainly introduces how to make all browsers support HTML5 tag style, the article is very detailed, has a certain reference value, interested friends must read it!

Now HTML5 is attracting more and more attention, but the browser that supports HTML5 is not mainstream, especially more than 50% of domestic users still use IE6, because IE9 that supports HTML5 does not support XP system installation, so for a long time in the future, HTML5 developers will have to consider the issue of backward compatibility. There are many ways to make HTML5 tags or CSS selectors compatible, one of which is to generate tag elements yourself.

The basic principle is that the following code works in IE8. Styles don't work at all.

The code is as follows:

mxria{ color: red; }

Hello!

In order for the browser to recognize the tag and display the corresponding style effect, we can add a js as follows, and see the effect differently.

The code is as follows:

mxria{ color: red; }

document.createElement("mxria")

Hello! mxria.com

Now you understand the mystery! Yes, it is document.createElement, HTML5 shiv is such a js plugin, all HTML5 tags are regenerated, you need to load the plugin, then HTML5 programs can be recognized by all browsers.

The above is "how to make all browsers support HTML5 tag style" all the content of this article, thank you for reading! Hope to share the content to help everyone, more relevant knowledge, welcome to pay attention to the industry information channel!

Tags: Tags browsers support browsing styles code that is effects content plug-ins articles generation differences mainstream values roles practices elements interests compatibility Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information vpn Shulou Technology Linux MySQL