header/footer/nav tags - what happens to these in IE7, IE8 and browsers than don't support HTML5?

▼魔方 西西 提交于 2019-12-17 08:05:36

问题


I am eager to start using Html5 in particular the <header>/<footer>/<article>/<nav> tags.

What happens if the browser doesn't support these?

Also I need to style these so: For Example: The nav has borders and margins etc. You know standard CSS stuff.

So if I style them using the nav tag then IE7 & IE8 etc are going to ignore this?


回答1:


Place this is the <head> section of your page, before any CSS files are loaded.

<!--[if lte IE 8]>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<![endif]-->

html5shi(m|v) creates doc elements for all the html5 elements so the styles from your CSS can kick in. Default behaviour for IE is to ignore unknown elements. For more info see resig's blog post.




回答2:


Yes, IE<9 will ignore any HTML5 elements (reason #3162 no one should ever have used IE) but there are javascript solutions for that which my groggy mind can't think of this morning. I'm sure others will post those solutions below. :)

First is the html5 shiv



来源:https://stackoverflow.com/questions/5367526/header-footer-nav-tags-what-happens-to-these-in-ie7-ie8-and-browsers-than-don

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!