Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 for IE6.0

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

like image 329
Répás Avatar asked Apr 17 '10 22:04

Répás


1 Answers

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/

like image 71
Jeff Fohl Avatar answered Sep 19 '22 14:09

Jeff Fohl