HTML5 and CSS3, Second Edition

(singke) #1
html5_new_tags/index.html
<!--[iflte IE 8]>
<script>
document.createElement("nav");
document.createElement("header");
document.createElement("footer");
document.createElement("section");
document.createElement("aside");
document.createElement("article");
</script>
<![endif]-->

This particular comment targets any version of Internet Explorer older than
version 9.0. If we reload our page, it looks correct now.

This approach creates a dependency on JavaScript, though, so you need to
take that into consideration. The improved organization and readability of
the document make it worth it, and since there are no accessibility concerns,
because the contents still display and are read by a screen reader, you’re only
making the presentation seem grossly out-of-date to your users who have
disabled JavaScript intentionally.

This approach is fine for adding support for a handful of elements or for
understanding how you can add support. Remy Sharp’s brilliant html5shiv
takes this approach much further and might be more appropriate for incor-
porating fallback support if you’re looking to support many more elements.^2


  1. http://code.google.com/p/html5shiv/


report erratum • discuss

Redefining a Blog Using Semantic Markup • 25


Download from Wow! eBook <www.wowebook.com>

Free download pdf