How to make all browsers support html5 tags and html5 tags
The solution I found on the Internet is to add the html5shiv Google reference to the head tag. The address is as follows:
<! -- [If IE]> <script src = "http://html5shiv.googlecode.com/svn/trunk/html5.js”> </script> <! [Endif] -->
Note:Copy the above Code to the head part. Remember to use the head part.(Because IE must know this element before parsing the element, this js file cannot be called elsewhere, otherwise it becomes invalid)
Do not forget to add block attributes to these custom tags:
/*html5*/ article,aside,dialog,footer,header,section,footer,nav,figure,menu{display:block}
However,The link method provided by the Internet was found to be unsuccessful in the ietester experiment on the virtual machine, that is, the js link could not be downloaded.
As a result, I failed to write the code above. I decided to paste the code in the head or write html5.js locally, just like this:
<! DOCTYPE html>
<Html>
<Head lang = "en">
<Meta charset = "UTF-8">
<Title> </title>
<Script>
(Function () {if (! /* @ Cc_on! @ */0) return; var e = "abbr, article, aside, audio, canvas, datalist, details, dialog, eventsource, figure, footer, header, hgroup, mark, menu, meter, nav, output, progress, section, time, video ". split (','), I = e. length; while (I --) {document. createElement (e [I]) }}) ()
</Script>
<Style>
/* Html5 */article, aside, dialog, footer, header, section, footer, nav, figure, menu {display: block}
Section {color: red}
</Style>
</Head>
<Body>
<Section> test </section>
</Body>
</Html>
After testing, ietest can be used in various versions. The red code mainly uses document. createElement adds a new tag for the browser and sets it to the block attribute. view the website of ppk, document. createElement is supported by all browsers. Pay attention to the position to add