How to make all browsers support html5 tags and html5 tags

Source: Internet
Author: User

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

 

Related Article

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.