I’m going to come right out and say that it’s likely to take IE years before we see native HTML 5 support. However, that doesn’t mean we should ignore HTML 5 until IE gets with the program.
If you’ve tried to mess around with HTML 5 in IE, you may have noticed that the new elements do not work correctly with css. Luckily for us, we can use a tiny bit of Javascript to trick IE into rending the HTML 5 elements correctly.
document.createElement('header');
document.createElement('footer');
document.createElement('aside');
document.createElement('nav');
document.createElement('article');
document.createElement('section');
The above snippet of Javascript will enable HTML 5 support for the following elements: header, footer, aside, nav, article, section. Should you need support for another element, just use the createElement function and set the parameter to be the element name.
Remember that you should only include the JS file with the ‘HTML 5 emulation’ code on IE.
Our next task in a later post is to emulate the video and audio elements.