Question

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

Was it helpful?

Solution

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/

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top