HTML5 for IE6.0

半世苍凉 提交于 2019-12-07 05:21:39

问题


Do you know any method to optimize this HTML Code to IE6 or 7 (or 8) without adding any HTML elements, or the IE is skipping all the HTML5 elements?

If i just want to format elements with CSS, - i dont want to use other features - is the document.createElement("nav") DOM element create enough to scam IE and make a plain HTML document?

<!DOCTYPE HTML>
<head>
<meta charset="UTF-8">
<title>title</title>
<link type="text/css" rel="stylesheet" href="reset.css">
<link type="text/css" rel="stylesheet" href="style.css">
</head>
<body>
<header>code of header</header>
<nav>
code of nav
</nav>
<section>
code of gallery
</section>
<article>
code of article
</article>
<footer>code of footer</footer>
</body>
</html>

Thank you.

More info about DOM create elements in IE6, IE7 and IE8 with html5 enabling script » here


回答1:


This code should work fine with IE6. Though, you may want to define your elements in your stylesheet to give them the properties you are looking for. Something like this:

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

EDIT: Oops. I am wrong about this. Shouldn't have posted so quickly. Reading this (which you probably just read as well): http://blog.whatwg.org/supporting-new-elements-in-ie

It appears that the Javascript hack you indicated above may be the only way to get these elements to render properly.

This script looks to be pretty handy and may solve your problem nicely, though I have not tested it: http://remysharp.com/2009/01/07/html5-enabling-script/




回答2:


IE8 does not support html5, just some random bits and pieces of it. IE6 or 7 even less.



来源:https://stackoverflow.com/questions/2660261/html5-for-ie6-0

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