HTML5 Shiv

From Wikipedia, the free encyclopedia
Jump to: navigation, search

HTML5Shiv is a JavaScript workaround, invented by Sjoerd Visscher, to enable styling of HTML5 elements in versions of Internet Explorer prior to version 9, which do not allow unknown elements to be styled without JavaScript. While some people refer to it as "HTML5Shim" with respect to shim, there is no real difference between the names and as noted in the code repository, the only difference is that "one has an m and one has a v - that's it."[1]

Internet Explorer compatibility and version usage[edit]

Prior to version 9 of Internet Explorer there was little to no support for HTML5 elements and other HTML5 features.[2]

Internet Explorer commands a large percentage of the usage share of web browsers. Within the Internet Explorer percentage, most of its current usage as of February 2013 comes from version 9, with version 8 holding the second-highest and version 7 the third-highest value.[3] With its high usage percentage, it is important to ensure that web pages function correctly in Internet Explorer. HTML5Shiv allows versions of Internet Explorer prior to version 9 to recognize the HTML5 tags and allows them to be styled using CSS.

Usage Example[edit]

Using HTML5 Shiv on an HTML5 web page is simple; you may do so with or without installation of the library. Below is an example of how to conditionally include HTML5 Shiv only for Internet Explorer browsers less-than version 9.

<!DOCTYPE html>
<html>
 <head>
  <!--[if lt IE 9]>
  <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/r29/html5.min.js"></script>
  <![endif]-->
 </head>
 <body>
 </body>
</html>

See cdnjs[4] for the changelog and recent version updates of the CDN version. You may also use the GitHub repository[1] to download the most up-to-date version of HTM5Shim and include it directly in your project directories.

See also[edit]

External links[edit]

References[edit]