首页 > Web开发 > 详细

HTMl5 兼容IE浏览器

时间:2015-11-27 02:05:52      阅读:266      评论:0      收藏:0      [点我收藏+]
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<!--[if IE]>
<script type="text/javascript">
(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])}})();
</script>
<![endif]-->
</head>
<style type="text/css">
header,nav,aside,article,footer{ display:block;}
</style>
<body>
<header>
	<p class="f_r"><a>手机访问</a>|<a>网站地图</a>|<a>来院路线</a>|<a>收藏本站</a></p>
</header>
<nav>
	<ul>
    	<li>导航一</li>
        <li>导航二</li>
        <li>导航三</li>
    </ul>
</nav>
<article>内容</article>
<aside>
	栅栏
</aside>
<footer>
	<p>备案信息</p>
</footer>
</body>
</html>

?

?

其中的代码如下,通过JS创建HTML5标签

<!--[if IE]>
<script type="text/javascript">
(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])}})();
</script>
<![endif]-->

?

其中的代码如下,这些标签本身就是块级标签,所以把这些标签转成块级标签

header,nav,aside,article,footer{ display:block;}

?

效果图:
bubuko.com,布布扣
?

?

HTMl5 兼容IE浏览器

原文:http://onestopweb.iteye.com/blog/2259501

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!