<!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;}