---
title: "让ie浏览器支持html5标签的实现方法"
author: "agevs"
date: "2014-08-18T13:24:56Z"
tags: []
categories: ["Web前端"]
slug: "ie-html5"
draft: false
lastmod: "2014-08-18T13:24:56Z"
id: 2105474
url: "https://agevs.iteye.com/blog/2105474"
---

Html5已经风靡很久了，不研究html5+css3实在有些过不去，今天先从最基本的开始介绍吧，让ie家族老前辈能够认识html5的新标签。[前端资源分享](/topic/1132907)

1.页面中加入代码

```
<!--[if lt IE 9]> 
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> 
<![endif]-->
```

 

2.定义一下CSS代码（Important）

```
article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section {display:block;} 
```

 

这个js文件原来的内容很少，现在可能更新了版本代码量加大了。具体差异在哪里我没有细究，贴出原来的代码。应该还是可以使用的。[前端资源分享](/topic/1132907)

```
(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])}})()
```

 

要的朋友拿去吧。可以直接放到页面中。不过注意第二步，给html5标签定义上display:block属性。