【技术】IE兼容HTML5
1. IE不认识<!-- -->,会读里面的语句,html5认为是注释,会忽略它;
2. article, aside, dialog, figure, footer, header,hgroup, menu, nav, section这些html5的标签,让ie把它当block;
3. 这个http://html5shiv.googlecode.com/svn/trunk/html5.js脚本可以解决IE支持html5问题,放在head里,让浏览器先解析这个脚本再解析后面的html5标签。
代码如下:
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<title>222比赛</title>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style>
article, aside, dialog, figure, footer, header,
hgroup, menu, nav, section { display: block; }
</style>
<meta name="description" content="" />
<meta name="author" content="" />
<link rel="stylesheet" type="text/css" href="style.css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>

浙公网安备 33010602011771号