http://developer.51cto.com/art/201205/334524.htm
http://www.jb51.net/html5/22826.html
http://www.cnblogs.com/jhti/archive/2011/07/13/2105039.html
讓IE(ie6/ie7/ie8)支持HTML5元素,我們需要在HTML頭部添加以下JavaScript,這是一個簡單的document.createElement聲明,利用條件註釋針對IE來調用這個js文件。Opera,FireFox等其他非IE瀏覽器就會忽視這段代碼,也不會存在http請求。
方式一:引用google的html5.js文件,代碼內容可以自己下載下來看。
<!–[if lt IE9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]–>
將以上代碼放到head標籤區間
方式二:自己coding JS搞定。
<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(', ');
var i= e.length;
while (i--){
document.createElement(e[i])
}
})()
</script>
不管你用上面哪中方式,請記得在CSS中進行如下定義,目的是讓這些標籤成爲塊狀元素,just like div。
/*html5*/
article,aside,dialog,footer,header,section,footer,nav,figure,menu{display:block}