HTML5 Elements and the IE Nightmare
Posted 2 years, 5 months ago

We all like HTML5 and some of us even think it's going to solve all of our problems.
While it's a bit soon to say that, it's not too soon to start using the technology.
I do that. I use HTML5 today. And you can do that too. Just mind the gap.
Not all browsers completely understand HTML5 yet. And then, there's always legacy support.
Still, the major cool browsers have excellent support for the new tech. IE... not so much.
The first problem you'll have is that IE does not understand HTML5 elements like section, header, article, et al. Since it does not understand them, it cannot style them - and that's your problem.
Luckily, I have a super-duper-simple solution.
- <!--[if IE]>
- <script>
- for( var html5elements = [ 'article', 'aside', 'dialog', 'figure', 'footer', 'header',
- 'hgroup', 'menu', 'nav', 'section', 'menu',
- 'time', 'mark', 'audio', 'video', 'source' ],
- i = 0, l = html5elements.length;
- i < l && document.createElement( html5elements[ i ] ); i++ );
- </script>
- <![endif]-->
Just paste that in the header of your website, since you want it to execute fast so IE can style the elements before the page gets dispalyed, and you're all set to play with the awesome semantic elements of HTML5.
Category: HTML5
Leave a Comment


