jQuery and ASP.NET

January 7, 2012

Use HTML 5 Elements in IE 8 using HTML 5 Shiv




There are a lot of new HTML 5 elements like <header>, <article>, <footer> etc. that browsers like IE 8 and versions prior to that, do not support. These browsers need some help recognizing the new HTML5 elements and Remy Sharp’s HTML 5 Shiv provides just that.

To use this script, it must be included before the <body> element (i.e. in the <head>).

To improve performance, include the CSS first and then this script. Here’s how to declare this script

<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]—>

This script enables IE to acknowledge the new HTML 5 elements by directing it to create the elements using JavaScript. The conditional comment shown above only loads the html5 shiv code when the version of IE is lower than 9.

You also need some CSS styling to render the elements as  block-level elements

image

'Like' us on our FaceBook page if you find this blog useful. Thanks!


Did you like this post?
kick it on DotNetKicks.com Save on Delicious
subscribe via rss subscribe via e-mail
print this post follow me on twitter


About The Author

Suprotim Agarwal, ASP.NET Architecture MVP works as an Architect Consultant and provides consultancy on how to design and develop Web applications.

Suprotim is also the founder and primary contributor to DevCurry, DotNetCurry and SQLServerCurry. He has also written an EBook 51 Recipes using jQuery with ASP.NET Controls.

Follow him on twitter @suprotimagarwal

comments

1 Response to "Use HTML 5 Elements in IE 8 using HTML 5 Shiv"
  1. Mr Thành said...
    January 11, 2012 12:04 AM

    very good ! thanks !

 

Copyright © 2009-2011 All Rights Reserved for DevCurry.com by Suprotim Agarwal | Terms and Conditions