HTML5 Shiv
HTML |
---|
Comparisons |
HTML5 Shiv is a JavaScript workaround, created 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.
Internet Explorer compatibility and version usage
Prior to version 9 of Internet Explorer there was little or no support for HTML5 elements and other HTML5 features.[1]
Internet Explorer had 30% usage share of web browsers in 2012, so this was urgently needed at a given time. Originally, within the Internet Explorer percentage, most of the usage was for version 9, with version 8 holding the second-highest and version 7 the third-highest value.[2] Within that situation, it was 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. Today, IE's usage share is 5%-10% with most of those IE users using IE9 or later,[3] thus rendering HTML5 Shiv largely irrelevant.[4]
Usage example
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. The script should be included within the <head>
element of the page, after any stylesheets:
<!DOCTYPE html>
<html>
<head>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<![endif]-->
</head>
<body>
</body>
</html>
See Cdnjs[5] for the changelog and recent version updates of the CDN version. You may also use the GitHub repository[6] to download the most up-to-date version of HTM5Shiv and include it directly in your project directories.
See also
External links
- HTML5Shiv Code Repository
- Resig, John (2008-01-24), John Resig's early discussion of the shiv, John Resig
- Chart overview of browser HTML5 and CSS3 compatibility
- HTML5, Older Browsers and the Shiv
- Irish, Paul (2011-05-24), The history of the HTML5 shiv, Paul Irish
References
- ↑ Internet Explorer 6-9 HTML5 and CSS Compatibility Overview
- ↑ Browser Usage by Version Feb 2012 to January 2013
- ↑ http://blog.pendo.io/2016/01/14/analysis-of-browser-usermarket-share-or-so-long-ie8-9-and-10/
- ↑ Browser Usage by Version Feb 2016 to January 2017
- ↑ Use HTML5Shiv without installing via CDN (cdnjs)
- ↑ HTML5Shiv GitHub Code Repository